Gisle Vanem <gva...@online.no> writes:

> Running 'nettle-benchmark.exe' gave me a crash in some
> .asm-code I failed to understand. It's signature is:
>  _nettle_sha256_compress_n (uint32_t *state, const uint32_t *k,
>                             size_t blocks, const uint8_t *input);
>
> But I noted it's .asm-code says 'W64_ENTRY(3, 0)'
> Why not 'W64_ENTRY(4, 0)' when there are 4 arguments?

That looks like an oversight, aka bug.

I try to do tests of windows builds using the x86_64-w64-mingw32-gcc
cross compiler + wine, but maybe that setup wasn't in working shape for
the 3.8 release. I've just reinstalled needed tools, and I get a dozen
of failures from make check.

> I admin 'm4' is alien to me, but changing it into:
>
> --- a/x86_64/sha256-compress-n.asm 2023-02-13 07:38:45
> +++ b/x86_64/sha256-compress-n.asm 2023-02-14 14:04:26
> @@ -134,7 +134,7 @@
>       ALIGN(16)
>
>  PROLOGUE(_nettle_sha256_compress_n)
> -     W64_ENTRY(3, 0)
> +     W64_ENTRY(4, 0)
>       test    BLOCKS, BLOCKS
>       jz      .Lend
>
> @@ -228,6 +228,6 @@
>       add     $120, %rsp
>  .Lend:
>       mov     INPUT, %rax
> -     W64_EXIT(3, 0)
> +     W64_EXIT(4, 0)
>       ret
>  EPILOGUE(_nettle_sha256_compress_n)
>
> -------
>
> fixed the crash.

Excellent. If you have time to go through and fix other cases of
W64_ENTRY/W64_EXIT, please post a patch on the mailinglist (or a merge
request on git.lysator.liu.se/nettle/nettle). Otherwise I'll look into
it, but I'm a bit busy with other things this week.

It would also be nice to setup some windows tests in the ci system
(which runs on a repo mirror at
https://gitlab.com/gnutls/nettle/-/pipelines), cross-compile + wine would
be the easiest for me to setup, but I think there are also some windows
"runners" that could maybe be used to try native windows builds.

> PS. I used a home-brewed GNU-makefile modelled
>     after a Cygwin build. Plus I used only Mini-GMP,
>     but .asm + AES asm-code.

I'm afraid I haven't ever tried native windows build myself. What's
preventing you from letting the configure script (in msys or cygwin)
create the Makefiles for you?

Regards,
/Niels

-- 
Niels Möller. PGP key CB4962D070D77D7FCB8BA36271D8F1FF368C6677.
Internet email is subject to wholesale government surveillance.
_______________________________________________
nettle-bugs mailing list -- nettle-bugs@lists.lysator.liu.se
To unsubscribe send an email to nettle-bugs-le...@lists.lysator.liu.se

Reply via email to