From: Steffen Jaeckel Date: Wed, 21 Apr 2021 10:21:29 +0200 Subject: [PATCH 1/5] lib: add crypt subsystem In-Reply-To: References: <20210412221523.3517153-1-jaeckel-floss@eyet-services.de> <20210412221523.3517153-2-jaeckel-floss@eyet-services.de> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Simon, thanks for taking the time to review. On 4/21/21 9:14 AM, Simon Glass wrote: > On Tue, 13 Apr 2021 at 10:16, 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 >> --- >> >> include/crypt.h | 13 ++ >> lib/Kconfig | 1 + >> lib/Makefile | 1 + >> lib/crypt/Kconfig | 29 ++++ >> 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 +++++++++ >> 11 files changed, 830 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 > > This seems to use errno - is that necessary? Also are there any simple > unit tests we could usefully bring over? Regarding errno - that's the way how libxcrypt works internally, I'm not sure whether we should really touch this ... the default crypt_alg_rn() function has a void return type, so either we have to keep using errno or we have to change the return type... Regarding unit tests - good idea, I'll have a look.