mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2026-05-14 07:28:06 +02:00
os: fix sha1 build error with Nettle 4.0
Nettle 2.6 (released in 2013) split the sha.h header into sha1.h & sha2.h,
but left the sha.h header for compatibility until the recent Nettle 4.0
release finally removed it.
Nettle 4.0 also dropped the length argument from the sha1_digest function.
Closes: #1871
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
(cherry picked from commit f8355b8821)
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2151>
This commit is contained in:
parent
34934c37d6
commit
65ae6543e8
2 changed files with 7 additions and 2 deletions
|
|
@ -273,7 +273,7 @@ foreach t : test_sha1
|
|||
sha1_dep = libsha1_dep
|
||||
endif
|
||||
elif t == 'libnettle'
|
||||
nettle_dep = dependency('nettle', required: false)
|
||||
nettle_dep = dependency('nettle', version: '>= 2.6', required: false)
|
||||
if nettle_dep.found()
|
||||
sha1_found = true
|
||||
sha1_dep = nettle_dep
|
||||
|
|
|
|||
|
|
@ -155,7 +155,8 @@ x_sha1_final(void *ctx, unsigned char result[20])
|
|||
|
||||
#elif defined(HAVE_SHA1_IN_LIBNETTLE) /* Use libnettle for SHA1 */
|
||||
|
||||
#include <nettle/sha.h>
|
||||
#include <nettle/sha1.h>
|
||||
#include <nettle/version.h>
|
||||
|
||||
void *
|
||||
x_sha1_init(void)
|
||||
|
|
@ -178,7 +179,11 @@ x_sha1_update(void *ctx, void *data, int size)
|
|||
int
|
||||
x_sha1_final(void *ctx, unsigned char result[20])
|
||||
{
|
||||
#if NETTLE_VERSION_MAJOR < 4
|
||||
sha1_digest(ctx, 20, result);
|
||||
#else
|
||||
sha1_digest(ctx, result);
|
||||
#endif
|
||||
free(ctx);
|
||||
return 1;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue