From 5545b8808bec28c4176b10f2b9eff979ab3e585a Mon Sep 17 00:00:00 2001 From: Jakub Jelen Date: Thu, 8 Jan 2026 22:08:33 +0100 Subject: [PATCH] sntrup: Avoid linking issues in external_override tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This linking worked only in CI and local builds, but not during the build in RPM as it fails on missing symbols that were defined only in the main library. This is solved as with the other digest dependencies in external crypto by removing the intermediate function. We are already linking the md_*.o objects. The error was like this sh: symbol lookup error: /path/libssh/libssh-0.12.0-build/libssh-0.12.0/redhat-linux-build/lib/libsntrup761_override.so: undefined symbol: crypto_hash_sha512 Signed-off-by: Jakub Jelen Reviewed-by: Pavol Žáčik Reviewed-by: Andreas Schneider --- include/libssh/sntrup761.h | 4 ---- src/external/sntrup761.c | 6 ++---- src/sntrup761.c | 7 ------- 3 files changed, 2 insertions(+), 15 deletions(-) diff --git a/include/libssh/sntrup761.h b/include/libssh/sntrup761.h index 96e9ce0c..aa05a9fd 100644 --- a/include/libssh/sntrup761.h +++ b/include/libssh/sntrup761.h @@ -35,10 +35,6 @@ extern "C" { #define HAVE_SNTRUP761 1 #endif -extern void crypto_hash_sha512(unsigned char *out, - const unsigned char *in, - unsigned long long inlen); - /* * Derived from public domain source, written by (in alphabetical order): * - Daniel J. Bernstein diff --git a/src/external/sntrup761.c b/src/external/sntrup761.c index b9bf7239..2f45622d 100644 --- a/src/external/sntrup761.c +++ b/src/external/sntrup761.c @@ -27,9 +27,7 @@ sntrup761_enc (uint8_t *c, uint8_t *k, const uint8_t *pk, void sntrup761_dec (uint8_t *k, const uint8_t *c, const uint8_t *sk); -extern void crypto_hash_sha512 (unsigned char *out, - const unsigned char *in, - unsigned long long inlen); +extern int sha512(const unsigned char *digest, size_t len, unsigned char *hash); #define MAX_LEN 761 @@ -701,7 +699,7 @@ Hash_prefix (unsigned char *out, int b, const unsigned char *in, int inlen) x[0] = b; for (i = 0; i < inlen; ++i) x[i + 1] = in[i]; - crypto_hash_sha512 (h, x, inlen + 1); + sha512 (x, inlen + 1, h); for (i = 0; i < 32; ++i) out[i] = h[i]; } diff --git a/src/sntrup761.c b/src/sntrup761.c index bc96439a..a67de437 100644 --- a/src/sntrup761.c +++ b/src/sntrup761.c @@ -37,13 +37,6 @@ #include "libssh/session.h" #include "libssh/ssh2.h" -void crypto_hash_sha512(unsigned char *out, - const unsigned char *in, - unsigned long long inlen) -{ - sha512(in, inlen, out); -} - #ifndef HAVE_LIBGCRYPT static void crypto_random(void *ctx, size_t length, uint8_t *dst) {