lkml.org 
[lkml]   [2022]   [Jul]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: include/crypto/chacha.h:100: undefined reference to `chacha_crypt_arch'
Hi,

On Mon, Jul 4, 2022 at 5:24 PM Vlad Dronov <vdronov@redhat.com> wrote:
>
> Hi,
>
> On Mon, Jul 4, 2022 at 4:58 PM Vlad Dronov <vdronov@redhat.com> wrote:
> >
> > Hi,
> >
> > On Mon, Jul 4, 2022 at 4:35 PM Vlad Dronov <vdronov@redhat.com> wrote:
> > >
> > > Hi,
> > >
> > > On Sun, Jul 3, 2022 at 12:51 AM kernel test robot <lkp@intel.com> wrote:
> > > > ...
> > > > config: s390-buildonly-randconfig-r005-20220703 (https://download.01.org/0day-ci/archive/20220703/202207030630.6SZVkrWf-lkp@intel.com/config)
> > > > ...
> > > > s390-linux-ld: lib/crypto/chacha20poly1305.o: in function `chacha_crypt':
> > > > >> include/crypto/chacha.h:100: undefined reference to `chacha_crypt_arch'
> > > > >> s390-linux-ld: include/crypto/chacha.h:100: undefined reference to `chacha_crypt_arch'
> > > > ...
> > > > Kconfig warnings: (for reference only)
> > > > WARNING: unmet direct dependencies detected for CRYPTO_LIB_CHACHA20POLY1305
> > > > Depends on (CRYPTO_ARCH_HAVE_LIB_CHACHA || !CRYPTO_ARCH_HAVE_LIB_CHACHA && (CRYPTO_ARCH_HAVE_LIB_POLY1305 || !CRYPTO_ARCH_HAVE_LIB_POLY1305 && CRYPTO
> > >
> > > Ok, this is either weird or I do not understand how the Kconfig system works.
> > >
> > > What I look at is CRYPTO_LIB_CHACHA20POLY1305 definition:
> > >
> > > [ lib/crypto/Kconfig ]
> > > config CRYPTO_LIB_CHACHA20POLY1305
> > > tristate "ChaCha20-Poly1305 AEAD support (8-byte nonce library version)"
> > > depends on CRYPTO_ARCH_HAVE_LIB_CHACHA || !CRYPTO_ARCH_HAVE_LIB_CHACHA
> > > depends on CRYPTO_ARCH_HAVE_LIB_POLY1305 || !CRYPTO_ARCH_HAVE_LIB_POLY1305
> > > depends on CRYPTO
> > >
> > > and this test's random config (s390-buildonly-randconfig-r005-20220703):
> > >
> > > $ grep -e CRYPTO_LIB_CHACHA20POLY1305 -e CRYPTO_ARCH_HAVE_LIB_CHACHA
> > > -e CRYPTO_ARCH_HAVE_LIB_POLY1305 -e CRYPTO= config
> > > CONFIG_CRYPTO=y
> > > CONFIG_CRYPTO_ARCH_HAVE_LIB_CHACHA=m
> > > CONFIG_CRYPTO_LIB_CHACHA20POLY1305=y
> > > // missing CRYPTO_ARCH_HAVE_LIB_POLY1305 implies =n (I guess?)
> > >
> > > I'm following the canonical "Kconfig Language" doc (
> > > https://www.kernel.org/doc/html/latest/kbuild/kconfig-language.html )
> > > which states:
> > >
> > > > - dependencies: “depends on” <expr>
> > > > This defines a dependency for this menu entry. If multiple dependencies are defined, they are connected with ‘&&’.
> > >
> > > and
> > >
> > > > '!' <expr> (6)
> > > > <expr> '&&' <expr> (7)
> > > > <expr> '||' <expr> (8)
> > > >
> > > > 6. Returns the result of (2-/expr/).
> > > > 7. Returns the result of min(/expr/, /expr/).
> > > > 8. Returns the result of max(/expr/, /expr/).
> > > > An expression can have a value of ‘n’, ‘m’ or ‘y’ (or 0, 1, 2 respectively for calculations).
> > >
> > > So calculating:
> > >
> > > (CRYPTO_ARCH_HAVE_LIB_CHACHA || !CRYPTO_ARCH_HAVE_LIB_CHACHA) &&
> > > (CRYPTO_ARCH_HAVE_LIB_POLY1305 || !CRYPTO_ARCH_HAVE_LIB_POLY1305) &&
> > > CRYPTO
> > >
> > > I find it equal to:
> > >
> > > (m || !m) && (n || !n) && y => m && y && y => m
> > >
> > > So CRYPTO_LIB_CHACHA20POLY1305 should be no higher than M, but it is
> > > =Y in a config file => weird :\ (or me wrong somewhere).
> > >
> > > WDYT?
> >
> > Ok, I should have tested this beforehand. With the configs set as above:
> >
> > CONFIG_CRYPTO=y
> > CONFIG_CRYPTO_CHACHA20_X86_64=m // implies the next line =m
> > CONFIG_CRYPTO_ARCH_HAVE_LIB_CHACHA=m
> > CONFIG_CRYPTO_ARCH_HAVE_LIB_POLY1305 is not set // =n
> >
> > "make menuconfig" allows only =n and =m for CRYPTO_LIB_CHACHA20POLY1305 indeed.
> > So the test robot has fed an invalid config to a build process. Let me
> > forward this thread to lkp@lists.01.org to report this issue.
>
> Hi,
>
> False alarm, I apologize.
>
> CRYPTO_LIB_CHACHA20POLY1305=y was selected by CONFIG_WIREGUARD=y:
>
> config WIREGUARD
> tristate "WireGuard secure network tunnel"
> depends on NET && INET
> depends on IPV6 || !IPV6
> select CRYPTO_LIB_CHACHA20POLY1305
>
> $ grep -e CONFIG_WIREGUARD= -e CONFIG_NETDEVICES= -e CONFIG_NET_CORE=
> -e CONFIG_NET= -e CONFIG_INET= -e CONFIG_IPV6= config
> CONFIG_NET=y
> CONFIG_INET=y
> CONFIG_IPV6=y
> CONFIG_NETDEVICES=y
> CONFIG_NET_CORE=y
> CONFIG_WIREGUARD=y
>
> This breaks the "In general use select only for non-visible symbols
> (no prompts anywhere)
> and for symbols with no dependencies" rules from the "Kconfig
> Language" doc, but I'm not
> sure how to proceed from here.

JFYI: fed with a config in question, "make menuconfig" just silently changes
CONFIG_CRYPTO_CHACHA_S390=m to =y
and, accordingly,
CONFIG_CRYPTO_ARCH_HAVE_LIB_CHACHA=m to =y
thus allowing a correct build.

Still not sure how to proceed from here with this clarification above.

Best regards,
Vladis Dronov | Red Hat, Inc. | The Core Kernel | Senior Software Engineer

\
 
 \ /
  Last update: 2022-07-04 17:43    [W:0.053 / U:0.116 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site