]> git.ipfire.org Git - thirdparty/openssl.git/commit
Fix calling convention bug in ecp_nistz256_ord_sqr_mont
authorDavid Benjamin <davidben@google.com>
Tue, 29 Jan 2019 04:39:17 +0000 (04:39 +0000)
committerBernd Edlinger <bernd.edlinger@hotmail.de>
Sun, 14 Apr 2019 10:55:53 +0000 (12:55 +0200)
commit15972296af6b98ae495ada9d4695f2a0e71f891c
tree086f1957ddc2d527c43de5fe8670fbae23821dfa
parent3051bf2afab7ac8b7b9c64e68755d1addd2fb8ff
Fix calling convention bug in ecp_nistz256_ord_sqr_mont

The rep parameter takes an int in C, but the assembly implementation
looks at the upper bits. While it's unlikely to happen here, where all
calls pass a constant, in other scenarios x86_64 compilers will leave
arbitrary values in the upper half.

Fix this by making the C prototype match the assembly. (This aspect of
the calling convention implies smaller-than-word arguments in assembly
functions should be avoided. There are far fewer things to test if
everything consistently takes word-sized arguments.)

This was found as part of ABI testing work in BoringSSL.

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
(Merged from https://github.com/openssl/openssl/pull/8108)
crypto/ec/asm/ecp_nistz256-armv8.pl
crypto/ec/asm/ecp_nistz256-ppc64.pl
crypto/ec/asm/ecp_nistz256-x86_64.pl
crypto/ec/ecp_nistz256.c