From 174d070a1a51cd9d3956f5a1a7e6f83c7d9d1b68 Mon Sep 17 00:00:00 2001 From: Dmitry Belyavskiy Date: Fri, 17 Nov 2023 16:36:18 +0100 Subject: [PATCH] Big-Endian platforms magma-mgm fix --- gost_gost2015.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gost_gost2015.c b/gost_gost2015.c index 7d207d0..8989ab1 100644 --- a/gost_gost2015.c +++ b/gost_gost2015.c @@ -465,8 +465,11 @@ int gost_mgm128_finish(mgm128_context *ctx, const unsigned char *tag, ctx->len.u[0] = alen; ctx->len.u[1] = clen; } else { - // TODO: check for big-endian +#ifdef L_ENDIAN ctx->len.u[0] = (alen >> 32) | clen; +#else + ctx->len.u[0] = (alen << 32) | clen; +#endif ctx->len.u[1] = 0; } -- 2.39.5