diff options
author | Michael Brown <mcb30@ipxe.org> | 2021-06-03 13:34:14 +0100 |
---|---|---|
committer | Michael Brown <mcb30@ipxe.org> | 2021-06-03 13:34:14 +0100 |
commit | f3f568e382a5f19824b3bfc6081cde39eee661e8 (patch) | |
tree | dddfc61b0b5e1674ca731ba39d79ec6e45f316dc /src/arch/x86/core/x86_bigint.c | |
parent | 74c54461cbb67e5ba20fc8119982a09121221853 (diff) | |
download | ipxe-bigint_output_constraints.zip ipxe-bigint_output_constraints.tar.gz ipxe-bigint_output_constraints.tar.bz2 |
[crypto] Add memory output constraints for big-integer inline assemblybigint_output_constraints
The ARM versions of the big-integer inline assembly functions include
constraints to indicate that the output value is modified by the
assembly code. These constraints are not present in the equivalent
code for the x86 versions.
As of GCC 11, this results in the compiler reporting that the output
values may be uninitialized.
Fix by including the relevant memory output constraints.
Reported-by: Christian Hesse <mail@eworm.de>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/arch/x86/core/x86_bigint.c')
-rw-r--r-- | src/arch/x86/core/x86_bigint.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/arch/x86/core/x86_bigint.c b/src/arch/x86/core/x86_bigint.c index 6413b2f..9a25bda 100644 --- a/src/arch/x86/core/x86_bigint.c +++ b/src/arch/x86/core/x86_bigint.c @@ -75,17 +75,18 @@ void bigint_multiply_raw ( const uint32_t *multiplicand0, * * a < 2^{n}, b < 2^{n} => ab < 2^{2n} */ - __asm__ __volatile__ ( "mull %4\n\t" - "addl %%eax, (%5,%2,4)\n\t" - "adcl %%edx, 4(%5,%2,4)\n\t" + __asm__ __volatile__ ( "mull %5\n\t" + "addl %%eax, (%6,%2,4)\n\t" + "adcl %%edx, 4(%6,%2,4)\n\t" "\n1:\n\t" - "adcl $0, 8(%5,%2,4)\n\t" + "adcl $0, 8(%6,%2,4)\n\t" "inc %2\n\t" /* Does not affect CF */ "jc 1b\n\t" : "=&a" ( discard_a ), "=&d" ( discard_d ), - "=&r" ( index ) + "=&r" ( index ), + "+m" ( *result ) : "0" ( multiplicand_element ), "g" ( multiplier_element ), "r" ( result_elements ), |