From mboxrd@z Thu Jan 1 00:00:00 1970 Delivery-date: Thu, 30 Jun 2022 16:20:52 +0200 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by lore.white.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1o6v2G-0025t4-Py for lore@lore.pengutronix.de; Thu, 30 Jun 2022 16:20:52 +0200 Received: from localhost ([127.0.0.1] helo=metis.ext.pengutronix.de) by metis.ext.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1o6v2J-0006fK-J7; Thu, 30 Jun 2022 16:20:51 +0200 Received: from smtp79.iad3a.emailsrvr.com ([173.203.187.79]) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o6v1R-0006bo-76 for ptxdist@pengutronix.de; Thu, 30 Jun 2022 16:19:58 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mev.co.uk; s=20190130-41we5z8j; t=1656598795; bh=slNjqUykoyUiYTu+k5XOtcnq8JLLW55ecJ2B6vIfQl8=; h=Date:Subject:To:From:From; b=C1umAc9peJsaQnC1Wgn9UxC7I00aZPNwnxh48IaIMcL4WsnQvNs6Cry/Kj/6eUpyG DOf7T5nLbI9+IlGp+uPWAJn4hbCHVn8jKeBCqLhYvcaAnxfrtDTfXymm6sa7WWldhS rp7JXXqTCyn5+Y1wTpawNguwMfNVAIllPAb25XlM= X-Auth-ID: abbotti@mev.co.uk Received: by smtp34.relay.iad3a.emailsrvr.com (Authenticated sender: abbotti-AT-mev.co.uk) with ESMTPSA id C027D22C0B; Thu, 30 Jun 2022 10:19:54 -0400 (EDT) Message-ID: <48995529-262a-e73c-32b3-7c812c0357ee@mev.co.uk> Date: Thu, 30 Jun 2022 15:19:53 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Content-Language: en-GB To: ptxdist@pengutronix.de, Alexander Dahl , dropbear@ucc.asn.au References: <3029238.yBh1puBK4d@ada> From: Ian Abbott Organization: MEV Ltd. In-Reply-To: <3029238.yBh1puBK4d@ada> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Classification-ID: e4405681-7bfc-4d03-b4f2-163aefea5d70-1-1 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on metis.ext.pengutronix.de X-Spam-Level: X-Spam-Status: No, score=-3.8 required=4.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Subject: Re: [ptxdist] build failure with recent dropbear 2022.82 on ptxdist for arm-v5te X-BeenThere: ptxdist@pengutronix.de X-Mailman-Version: 2.1.29 Precedence: list List-Id: PTXdist Development Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: ptxdist@pengutronix.de Sender: "ptxdist" X-SA-Exim-Connect-IP: 127.0.0.1 X-SA-Exim-Mail-From: ptxdist-bounces@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false On 30/06/2022 12:57, Alexander Dahl wrote: > Hello, > > trying to build dropbear as part of a ptxdist based embedded BSP for an > armv5te target, more precisely I try to upgrade dropbear from 2020.81 to > 2022.82, the previous version builds fine, the new one fails to build. > > Cross toolchain is OSELAS.Toolchain-2016.06.1/arm-v5te-linux-gnueabi/ > gcc-5.4.0-glibc-2.23-binutils-2.26-kernel-4.6-sanitized > > According to config.log … Invocation command line was > > $ ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var -- > libdir=/usr/lib --build=x86_64-host-linux-gnu --host=arm-v5te-linux-gnueabi -- > enable-harden --enable-largefile --disable-zlib --disable-pam --enable-openpty > --enable-syslog --enable-shadow --disable-plugin --disable-fuzz --enable- > bundled-libtom --disable-lastlog --disable-utmp --disable-utmpx --disable-wtmp > --disable-wtmpx --disable-loginfunc --disable-pututline --disable-pututxline > > And localoptions.h was set to this: > > /* localoptions.h created by ptxdist */ > #define DROPBEAR_X11FWD 0 > #define DROPBEAR_CLI_LOCALTCPFWD 1 > #define DROPBEAR_CLI_REMOTETCPFWD 1 > #define DROPBEAR_SVR_LOCALTCPFWD 1 > #define DROPBEAR_SVR_REMOTETCPFWD 1 > #define DROPBEAR_SVR_AGENTFWD 0 > #define DROPBEAR_CLI_AGENTFWD 0 > #define DROPBEAR_AES128 1 > #define DROPBEAR_3DES 0 > #define DROPBEAR_AES256 1 > #define DROPBEAR_ENABLE_CBC_MODE 0 > #define DROPBEAR_ENABLE_CTR_MODE 1 > #define DROPBEAR_SHA1_HMAC 0 > #define DROPBEAR_DH_GROUP1 0 > #define DROPBEAR_DH_GROUP14_SHA1 0 > #define DROPBEAR_SHA1_96_HMAC 0 > #define DROPBEAR_SHA2_256_HMAC 1 > #define DROPBEAR_SHA2_512_HMAC 1 > #define DROPBEAR_DSS 0 > #define DROPBEAR_RSA 1 > #define DROPBEAR_ECDSA 0 > #define DROPBEAR_ECDH 0 > #define DROPBEAR_CURVE25519 0 > #define DROPBEAR_SVR_PASSWORD_AUTH 1 > #define DROPBEAR_CLI_PASSWORD_AUTH 1 > #define DROPBEAR_SVR_PUBKEY_AUTH 1 > #define DROPBEAR_CLI_PUBKEY_AUTH 1 > > The compile error is like this: > > arm-v5te-linux-gnueabi-gcc -c -Os -W -Wall -Wno-pointer-sign -fno-strict- > overflow -fPIE -fstack-protector-strong -D_FORTIFY_SOURCE=2 -I./libtomcrypt/ > src/headers/ -DLOCALOPTIONS_H_EXISTS -I. -I. -DDROPBEAR_SERVER - > DDROPBEAR_CLIENT signkey.c -o signkey.o > In file included from signkey.c:31:0: > sk-ecdsa.h:11:44: error: unknown type name 'ecc_key' > signkey.c: In function 'buf_get_pub_key': > signkey.c:318:17: error: 'DROPBEAR_SIGNKEY_SK_ECDSA_NISTP256' undeclared > (first use in this function) > signkey.c:318:17: note: each undeclared identifier is reported only once for > each function it appears in > signkey.c: In function 'buf_verify': > signkey.c:688:17: error: 'DROPBEAR_SIGNKEY_SK_ECDSA_NISTP256' undeclared > (first use in this function) > signkey.c:689:3: error: unknown type name 'ecc_key' > signkey.c:689:20: error: 'ecc_key' undeclared (first use in this function) > signkey.c:689:29: error: expected expression before ')' token > make[1]: *** [Makefile:154: signkey.o] Error 1 > > I looked into the dropbear code, and sk-ecdsa.h includes "includes.h" which > itself includes "tomcrypt.h" and in some file of that 'ecc_key' is defined, so > I don't know why the compiler complains here. > > Did not look into the other errors however. > > Any ideas? I think the problem occurs when DROPBEAR_SK_ECDSA is 1 and DROPBEAR_ECDSA is 0. The upstream maintainers can determine whether this combination should be supported or not. The ptxdist rules for dropbear 2020.81 (the current version in ptxdist) did not configure DROPBEAR_SK_ECDSA in "localoptions.h", so DROPBEAR_SK_ECDSA gets defined with the default value 1 in "default_options_guard.h" (generated from "default_options.h"). As a temporary measure, you can change ptxdist's "dropbear.make" to forcibly configure DROPBEAR_SK_ECDSA to 0 by adding these lines in the appropriate place before the `@$(call touch)` line in the `$(STATEDIR)/dropbear.prepare` rules: @echo "ptxdist: disabling sk_ecdsa" @echo "#define DROPBEAR_SK_ECDSA 0" >> $(DROPBEAR_LOCALOPTIONS) You could also add these lines to forcibly configure DROPBEAR_SK_ED25519 to 0 (not needed to fix the build, but it should reduce the executable size): @echo "ptxdist: disabling sk_ed25519" @echo "#define DROPBEAR_SK_ED25519 0" >> $(DROPBEAR_LOCALOPTIONS) (Ideally, extra configuration options for the new features should be added to ptxdist's "dropbear.in", and should automatically select DROPBEAR_ECDSA when DROPBEAR_SK_ECDSA is configured.) Alternatively, you could just select the DROPBEAR_ECSDA option in the configuration anyway, but that will increase the size of the dropbear executable. -- -=( Ian Abbott || MEV Ltd. is a company )=- -=( registered in England & Wales. Regd. number: 02862268. )=- -=( Regd. addr.: S11 & 12 Building 67, Europa Business Park, )=- -=( Bird Hall Lane, STOCKPORT, SK3 0XA, UK. || www.mev.co.uk )=-