FYI: fix for big-endian systems pushed to V_9_9 branch
Damien Miller
djm at mindrot.org
Wed Oct 30 07:54:19 AEDT 2024
On Tue, 29 Oct 2024, Tom G. Christensen wrote:
> On 27/10/2024 05:45, Damien Miller wrote:
> > If you distribute OpenSSH to big-endian systems and have packaged
> > OpenSSH 9.9 already, then I recommend you include these fixes as the
> > next release of OpenSSH will make this key exchange algorithm the
> > default.
> >
>
> I tried to update my Solaris builds but ran into a build error.
>
> In file included from kexmlkem768x25519.c:50:
> libcrux_mlkem768_sha3.h: In function 'core_num__u64_9__to_le_bytes':
> libcrux_mlkem768_sha3.h:164: error: '__uint64_t' undeclared (first use in this
> function)
> libcrux_mlkem768_sha3.h:164: error: (Each undeclared identifier is reported
> only once
> libcrux_mlkem768_sha3.h:164: error: for each function it appears in.)
> libcrux_mlkem768_sha3.h: In function 'core_num__u64_9__from_le_bytes':
> libcrux_mlkem768_sha3.h:170: error: '__uint64_t' undeclared (first use in this
> function)
> gmake: *** [kexmlkem768x25519.o] Error 1
>
> AFAICT __uint64_t is not available on at least Solaris 10 and older.
oops, I think this should fix it:
diff --git a/defines.h b/defines.h
index b02f2942a..c1c21aba6 100644
--- a/defines.h
+++ b/defines.h
@@ -653,14 +653,14 @@ struct winsize {
((uint32_t)(v) & 0xff0000) >> 8 | \
((uint32_t)(v) & 0xff000000) >> 24)
# define openssh_swap64(v) \
- (__uint64_t)((((__uint64_t)(v) & 0xff) << 56) | \
- ((__uint64_t)(v) & 0xff00ULL) << 40 | \
- ((__uint64_t)(v) & 0xff0000ULL) << 24 | \
- ((__uint64_t)(v) & 0xff000000ULL) << 8 | \
- ((__uint64_t)(v) & 0xff00000000ULL) >> 8 | \
- ((__uint64_t)(v) & 0xff0000000000ULL) >> 24 | \
- ((__uint64_t)(v) & 0xff000000000000ULL) >> 40 | \
- ((__uint64_t)(v) & 0xff00000000000000ULL) >> 56)
+ (uint64_t)((((uint64_t)(v) & 0xff) << 56) | \
+ ((uint64_t)(v) & 0xff00ULL) << 40 | \
+ ((uint64_t)(v) & 0xff0000ULL) << 24 | \
+ ((uint64_t)(v) & 0xff000000ULL) << 8 | \
+ ((uint64_t)(v) & 0xff00000000ULL) >> 8 | \
+ ((uint64_t)(v) & 0xff0000000000ULL) >> 24 | \
+ ((uint64_t)(v) & 0xff000000000000ULL) >> 40 | \
+ ((uint64_t)(v) & 0xff00000000000000ULL) >> 56)
# ifdef WORDS_BIGENDIAN
# define le32toh(v) (openssh_swap32(v))
# define le64toh(v) (openssh_swap64(v))
More information about the openssh-unix-dev
mailing list