From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 361EFC07E96 for ; Thu, 8 Jul 2021 03:56:37 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 588EB61CDD for ; Thu, 8 Jul 2021 03:56:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 588EB61CDD Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A341B83117; Thu, 8 Jul 2021 05:56:34 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1625716594; bh=LUseQtHJ183gCS5zXAQAVHEaviUXkWr8F4Ugc/TgLcQ=; h=Subject:To:Cc:References:From:Date:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Reply-To:From; b=yWXxkIRYrO0QfchDmp8i5ntP3MmqO0f31gGrKeoz8azykAzL6JHxR1Y1+KrsIY8Dq 4bvZbZj8GLYWyFwzOVJOVxQGrcczPegtT8GxQ53Y2ATMB2G/vN4mG/I3XmiTvSfHV2 AUnP9KQX/Q4Y8gAuWNTaue3GhlEzU7+V/s9sStLm+m9XFYxb7FpEzekzGqfLBSTKEd GM04Nh4EtFalKUzDxHcD6UW3VUWmv2HrtQJVLSpC0kFoloE+KAotW+2rYRGoIFf42o bd2MsADfEyqd0XaCunPc+vq5JlTNLaHcen0F0+s07HENUKFpQXP+go7+O93kLiwns4 ZNvmnlJ1p0fEw== Received: from [192.168.1.107] (89-186-115-213.pool.digikabel.hu [89.186.115.213]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: hs@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id C661F81671; Thu, 8 Jul 2021 05:56:29 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1625716593; bh=LUseQtHJ183gCS5zXAQAVHEaviUXkWr8F4Ugc/TgLcQ=; h=Subject:To:Cc:References:Reply-To:From:Date:In-Reply-To:From; b=v/SKUiKZTrxvpRmWYulZmnWnznVBs8sweDlKutSdPHBi/dL34/ouvccc5VnXbfzqg lWgsOfJ9yFGcBfy/L73p6sIict317TyXv3etqEG/Tt/BN9e0dG6DIPqia/uAN5/dFG yZGic5YYSKgqbh3MOGCV1fKZPJc3iL0YXXFMojnNU6I4DXrHEE/Ps5P5//+/qLwSYd xhTBe88etqaQI3gtedcoGeAe+qUZY8lXk7oLHD6d9/bnyKfoxUvd+Dk/NO8ZaPq08W BYWTzzvC44aR77XyQV/PzqUUuWR5M7KU4AGXm8sZ9yb8y8KQkczt3Q+o6oEM35X0Tk +KqYELUCS29HA== Subject: Re: [PATCH v4 1/8] lib: add crypt subsystem To: Steffen Jaeckel , u-boot@lists.denx.de Cc: Simon Glass , Alexandru Gagniuc , Anastasiia Lukianenko , Andrii Anisov , Aswath Govindraju , Bin Meng , Christian Gmeiner , Heinrich Schuchardt , Joel Stanley , Marek Szyprowski , Masahisa Kojima , Patrick Delaunay , Sean Anderson , Tero Kristo References: <20210707230946.2497660-1-jaeckel-floss@eyet-services.de> <20210707230946.2497660-2-jaeckel-floss@eyet-services.de> From: Heiko Schocher Message-ID: <83de7556-8766-b320-b1d0-7f76f96201a4@denx.de> Date: Thu, 8 Jul 2021 05:56:31 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <20210707230946.2497660-2-jaeckel-floss@eyet-services.de> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: hs@denx.de Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean Hello Steffen, On 08.07.21 01:09, Steffen Jaeckel wrote: > Add the basic functionality required to support the standard crypt > format. > The files crypt-sha256.c and crypt-sha512.c originate from libxcrypt and > their formatting is therefor retained. > The integration is done via a crypt_compare() function in crypt.c. > > ``` > libxcrypt $ git describe --long --always --all > tags/v4.4.17-0-g6b110bc > ``` > > Signed-off-by: Steffen Jaeckel > Reviewed-by: Simon Glass > --- > > Changes in v4: > Fix depends for unit-tests > > Changes in v3: > Add unit-tests for autoboot > Introduce `bootstopusesha256` to allow fallback to plain SHA256-based > hashing > Add AUTOBOOT_FLUSH_STDIN option > Drop the changes to bcm963158_ram_defconfig > > Changes in v2: > Update Kconfig way of enabling, setting hashes etc. > > Changes in v1: > Added unit-tests of crypt_compare() > Wrapped crypt functions to encapsulate errno Reviewed-by: Heiko Schocher Nitpicks below... > include/crypt.h | 13 ++ > lib/Kconfig | 1 + > lib/Makefile | 1 + > lib/crypt/Kconfig | 28 ++++ > lib/crypt/Makefile | 10 ++ > lib/crypt/alg-sha256.h | 17 ++ > lib/crypt/alg-sha512.h | 17 ++ > lib/crypt/crypt-port.h | 28 ++++ > lib/crypt/crypt-sha256.c | 313 +++++++++++++++++++++++++++++++++++++ > lib/crypt/crypt-sha512.c | 328 +++++++++++++++++++++++++++++++++++++++ > lib/crypt/crypt.c | 73 +++++++++ > test/Kconfig | 10 ++ > test/lib/Makefile | 1 + > test/lib/test_crypt.c | 44 ++++++ > 14 files changed, 884 insertions(+) > create mode 100644 include/crypt.h > create mode 100644 lib/crypt/Kconfig > create mode 100644 lib/crypt/Makefile > create mode 100644 lib/crypt/alg-sha256.h > create mode 100644 lib/crypt/alg-sha512.h > create mode 100644 lib/crypt/crypt-port.h > create mode 100644 lib/crypt/crypt-sha256.c > create mode 100644 lib/crypt/crypt-sha512.c > create mode 100644 lib/crypt/crypt.c > create mode 100644 test/lib/test_crypt.c [...] > diff --git a/lib/crypt/Makefile b/lib/crypt/Makefile > new file mode 100644 > index 0000000000..290231064c > --- /dev/null > +++ b/lib/crypt/Makefile > @@ -0,0 +1,10 @@ > +# SPDX-License-Identifier: GPL-2.0+ > +# > +# Copyright (c) 2013, Google Inc. > +# > +# (C) Copyright 2000-2007 > +# Wolfgang Denk, DENX Software Engineering, wd@denx.de. Hmm... this is a new file ... I think you should add only your Copyright and drop the others... ? > +obj-$(CONFIG_CRYPT_PW) += crypt.o > +obj-$(CONFIG_CRYPT_PW_SHA256) += crypt-sha256.o > +obj-$(CONFIG_CRYPT_PW_SHA512) += crypt-sha512.o [...] > diff --git a/lib/crypt/crypt-sha256.c b/lib/crypt/crypt-sha256.c > new file mode 100644 > index 0000000000..37127d41e1 > --- /dev/null > +++ b/lib/crypt/crypt-sha256.c > @@ -0,0 +1,313 @@ > +/* One way encryption based on the SHA256-based Unix crypt implementation. > + * > + * Written by Ulrich Drepper in 2007 [1]. > + * Modified by Zack Weinberg in 2017, 2018. > + * Composed by Björn Esser in 2018. > + * Modified by Björn Esser in 2020. > + * Modified by Steffen Jaeckel in 2020. > + * To the extent possible under law, the named authors have waived all > + * copyright and related or neighboring rights to this work. > + * > + * See https://creativecommons.org/publicdomain/zero/1.0/ for further > + * details. > + * > + * This file is a modified except from [2], lines 648 up to 909. > + * > + * [1] https://www.akkadia.org/drepper/sha-crypt.html > + * [2] https://www.akkadia.org/drepper/SHA-crypt.txt > + */ I miss here the SPDX license identifier... also some hint, from which exact version this code is from ... > diff --git a/lib/crypt/crypt-sha512.c b/lib/crypt/crypt-sha512.c > new file mode 100644 > index 0000000000..3616019445 > --- /dev/null > +++ b/lib/crypt/crypt-sha512.c > @@ -0,0 +1,328 @@ > +/* One way encryption based on the SHA512-based Unix crypt implementation. > + * > + * Written by Ulrich Drepper in 2007 [1]. > + * Modified by Zack Weinberg in 2017, 2018. > + * Composed by Björn Esser in 2018. > + * Modified by Björn Esser in 2020. > + * Modified by Steffen Jaeckel in 2020. > + * To the extent possible under law, the named authors have waived all > + * copyright and related or neighboring rights to this work. > + * > + * See https://creativecommons.org/publicdomain/zero/1.0/ for further > + * details. > + * > + * This file is a modified except from [2], lines 1403 up to 1676. > + * > + * [1] https://www.akkadia.org/drepper/sha-crypt.html > + * [2] https://www.akkadia.org/drepper/SHA-crypt.txt > + */ same here Thanks! bye, Heiko -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-52 Fax: +49-8142-66989-80 Email: hs@denx.de