Skip to contentSkip to conversation

crypto: poly1305 - cleanup stray CRYPTO_LIB_POLY1305_RSIZE

PATCH Superseded Jason A. Donenfeld 3 participants 5 messages May 26, 2022 – May 27, 2022 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

Jason A. Donenfeld

author maintainer
#0 lore raw

PATCH 1/1 crypto: poly1305 - cleanup stray CRYPTO_LIB_POLY1305_RSIZE

When CRYPTO_LIB_POLY1305 is unset, CRYPTO_LIB_POLY1305_RSIZE is still set in the Kconfig, cluttering things. Fix this by making CRYPTO_LIB_POLY1305_RSIZE depend on CRYPTO_LIB_POLY1305.

---
 lib/crypto/Kconfig | 1 +
 1 file changed, 1 insertion(+)
lib/crypto/Kconfig +1 -0
index 379a66d7f504..a80b8c4dc2cf 100644
@@ -85,6 +85,7 @@ config CRYPTO_LIB_POLY1305_RSIZE
 	default 11 if X86_64
 	default 9 if ARM || ARM64
 	default 1
+	depends on CRYPTO_LIB_POLY1305
 
 config CRYPTO_ARCH_HAVE_LIB_POLY1305
 	tristate
Signature · 1 line
2.35.1
#1 lore raw
I love your patch! Yet something to improve:

Hi "Jason,

I love your patch! Yet something to improve:

[auto build test ERROR on herbert-cryptodev-2.6/master]
[also build test ERROR on herbert-crypto-2.6/master crng-random/master v5.18 next-20220526] [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/Jason-A-Donenfeld/crypto-poly1305-cleanup-stray-CRYPTO_LIB_POLY1305_RSIZE/20220526-173718
base:   https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git master
config: i386-debian-10.3-kselftests (https://download.01.org/0day-ci/archive/20220527/[email protected]/config)
compiler: gcc-11 (Debian 11.3.0-1) 11.3.0
reproduce (this is a W=1 build):
        # https://github.com/intel-lab-lkp/linux/commit/fde026a9e6312b3278b170ca6a41cd84a6fb935e
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Jason-A-Donenfeld/crypto-poly1305-cleanup-stray-CRYPTO_LIB_POLY1305_RSIZE/20220526-173718
        git checkout fde026a9e6312b3278b170ca6a41cd84a6fb935e
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash lib/crypto/

If you fix the issue, kindly add following tag where applicable

All errors (new ones prefixed by >>):

In file included from include/crypto/internal/poly1305.h:11,

                    from lib/crypto/poly1305-donna32.c:11:
>> include/crypto/poly1305.h:56:46: error: 'CONFIG_CRYPTO_LIB_POLY1305_RSIZE' undeclared here (not in a function); did you mean 'CONFIG_CRYPTO_POLY1305_MODULE'?
      56 |                 struct poly1305_key opaque_r[CONFIG_CRYPTO_LIB_POLY1305_RSIZE];
         |                                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |                                              CONFIG_CRYPTO_POLY1305_MODULE

vim +56 include/crypto/poly1305.h

878afc35cd28bc Eric Biggers       2018-11-16  40  
2546f811ef45fc Martin Willi       2015-07-16  41  struct poly1305_desc_ctx {
2546f811ef45fc Martin Willi       2015-07-16  42  	/* partial buffer */
2546f811ef45fc Martin Willi       2015-07-16  43  	u8 buf[POLY1305_BLOCK_SIZE];
2546f811ef45fc Martin Willi       2015-07-16  44  	/* bytes used in partial buffer */
2546f811ef45fc Martin Willi       2015-07-16  45  	unsigned int buflen;
ad8f5b88383ea6 Ard Biesheuvel     2019-11-08  46  	/* how many keys have been set in r[] */
ad8f5b88383ea6 Ard Biesheuvel     2019-11-08  47  	unsigned short rset;
ad8f5b88383ea6 Ard Biesheuvel     2019-11-08  48  	/* whether s[] has been set */
2546f811ef45fc Martin Willi       2015-07-16  49  	bool sset;
ad8f5b88383ea6 Ard Biesheuvel     2019-11-08  50  	/* finalize key */
ad8f5b88383ea6 Ard Biesheuvel     2019-11-08  51  	u32 s[4];
ad8f5b88383ea6 Ard Biesheuvel     2019-11-08  52  	/* accumulator */
ad8f5b88383ea6 Ard Biesheuvel     2019-11-08  53  	struct poly1305_state h;
ad8f5b88383ea6 Ard Biesheuvel     2019-11-08  54  	/* key */
1c08a104360f3e Jason A. Donenfeld 2020-01-05  55  	union {
1c08a104360f3e Jason A. Donenfeld 2020-01-05 @56  		struct poly1305_key opaque_r[CONFIG_CRYPTO_LIB_POLY1305_RSIZE];
1c08a104360f3e Jason A. Donenfeld 2020-01-05  57  		struct poly1305_core_key core_r;
1c08a104360f3e Jason A. Donenfeld 2020-01-05  58  	};
2546f811ef45fc Martin Willi       2015-07-16  59  };

2546f811ef45fc Martin Willi 2015-07-16 60

Signature · 2 lines
0-DAY CI Kernel Test Service
https://01.org/lkp
author maintainer
#2 lore raw

PATCH v2 1/1 crypto: poly1305 - cleanup stray CRYPTO_LIB_POLY1305_RSIZE

When CRYPTO_LIB_POLY1305 is unset, CRYPTO_LIB_POLY1305_RSIZE is still set in the Kconfig, cluttering things. Fix this by making CRYPTO_LIB_POLY1305_RSIZE depend on CRYPTO_LIB_POLY1305 and other various related config options.

---
Changes v1->v2:
- Also depend on CRYPTO_ARCH_HAVE_LIB_POLY1305 and CRYPTO_LIB_POLY1305_GENERIC, after kbuild bot warning. Hopefully this handles all the weird edge cases in this unfortunate maze.

 lib/crypto/Kconfig | 1 +
 1 file changed, 1 insertion(+)
lib/crypto/Kconfig +1 -0
index 379a66d7f504..7ee13c08c970 100644
@@ -85,6 +85,7 @@ config CRYPTO_LIB_POLY1305_RSIZE
 	default 11 if X86_64
 	default 9 if ARM || ARM64
 	default 1
+	depends on CRYPTO_LIB_POLY1305 || CRYPTO_ARCH_HAVE_LIB_POLY1305 || CRYPTO_LIB_POLY1305_GENERIC
 
 config CRYPTO_ARCH_HAVE_LIB_POLY1305
 	tristate
Signature · 1 line
2.35.1

A message that is not in the archive (sent off-list or not yet received): CAHk-=whyH8xx=2LVmOdQDTy9RRqBs_JJz_oMV2+6a2myk8+wow@mail.gmail.com

author maintainer
#4 lore raw

Hi Linus,

Quoted 4 lines · Linus Torvalds

Oh well. I already applied your v1 patch earlier today..

Linus

Whoops. I sent this to linux-crypto/Herbert assuming that it'd work with the "2 weeks pass and nobody complains --> queued up" flow of that list.

I can send you a patch on top of your tree to fix the v1 you applied. But let's let the kernel test robot chew on my v2 for a day or two. The crypto/ Kconfig system is incredibly convoluted, and the config fuzzing the robot does tends to be (unfortunately) helpful.

Jason

#5 lore raw
Quoted 4 lines · Jason A. Donenfeld

Whoops. I sent this to linux-crypto/Herbert assuming that it'd work with the "2 weeks pass and nobody complains --> queued up" flow of that list.

Well, it's more like "4 months since I complained about this thing", so I thought it was overdue and applied it..

That said, I don't think CRYPTO_LIB_POLY1305_GENERIC can be set unless CRYPTO_LIB_POLY1305 is set. And CRYPTO_ARCH_HAVE_LIB_POLY1305 looks like a bogus thing to test for too - those two just decide if the arch-specific one or the generic one should be used.

So I think v1 was actually the right one. Possibly

        depends on CRYPTO_LIB_POLY1305 != n

due to the tristate?

Linus