diff options
author | Jan Janssen <medhefgo@web.de> | 2022-06-24 10:04:30 +0200 |
---|---|---|
committer | Luca Boccassi <luca.boccassi@gmail.com> | 2022-06-24 18:51:17 +0200 |
commit | 4e5c39597add4c0e3c479fc11d562f6ea92f22de (patch) | |
tree | c8e59dd282fd5d788bfa17be111b1b4c42af0bb2 /src | |
parent | mkosi: Pull in fix that solves action mirror issue (diff) | |
download | systemd-4e5c39597add4c0e3c479fc11d562f6ea92f22de.tar.xz systemd-4e5c39597add4c0e3c479fc11d562f6ea92f22de.zip |
sha256: Use stdbool and uintptr_t
This also syncs the copyright blurb with current glibc sources. The
written by line does not appear in upstream, so it should be okay to
remove.
Diffstat (limited to 'src')
-rw-r--r-- | src/fundamental/sha256.c | 18 | ||||
-rw-r--r-- | src/fundamental/sha256.h | 7 |
2 files changed, 6 insertions, 19 deletions
diff --git a/src/fundamental/sha256.c b/src/fundamental/sha256.c index f089594796..31d9674d09 100644 --- a/src/fundamental/sha256.c +++ b/src/fundamental/sha256.c @@ -4,7 +4,7 @@ /* Functions to compute SHA256 message digest of files or memory blocks. according to the definition of SHA256 in FIPS 180-2. - Copyright (C) 2007-2019 Free Software Foundation, Inc. + Copyright (C) 2007-2022 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -19,10 +19,9 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -/* Written by Ulrich Drepper <drepper@redhat.com>, 2007. */ + <https://www.gnu.org/licenses/>. */ +#include <stdbool.h> #ifdef SD_BOOT # include "efi-string.h" #else @@ -52,15 +51,9 @@ /* The condition below is from glibc's string/string-inline.c. * See definition of _STRING_INLINE_unaligned. */ #if !defined(__mc68020__) && !defined(__s390__) && !defined(__i386__) - -/* To check alignment gcc has an appropriate operator. Other compilers don't. */ -# if __GNUC__ >= 2 -# define UNALIGNED_P(p) (((size_t) p) % __alignof__(uint32_t) != 0) -# else -# define UNALIGNED_P(p) (((size_t) p) % sizeof(uint32_t) != 0) -# endif +# define UNALIGNED_P(p) (((uintptr_t) p) % __alignof__(uint32_t) != 0) #else -# define UNALIGNED_P(p) sd_false +# define UNALIGNED_P(p) false #endif /* This array contains the bytes used to pad the buffer to the next @@ -201,7 +194,6 @@ void sha256_process_bytes(const void *buffer, size_t len, struct sha256_ctx *ctx } } - /* Process LEN bytes of BUFFER, accumulating context into CTX. It is assumed that LEN % 64 == 0. */ static void sha256_process_block(const void *buffer, size_t len, struct sha256_ctx *ctx) { diff --git a/src/fundamental/sha256.h b/src/fundamental/sha256.h index e53197f2ef..f296f76ae8 100644 --- a/src/fundamental/sha256.h +++ b/src/fundamental/sha256.h @@ -1,12 +1,7 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -#ifdef SD_BOOT -#include <efi.h> -#include <efilib.h> -#endif - -#include "types-fundamental.h" +#include "stdint.h" #define SHA256_DIGEST_SIZE 32 |