bug in ghash-x86_64.pl for non-AVX assemblers?

Michael Wojcik Michael.Wojcik at microfocus.com
Fri Aug 2 14:00:59 UTC 2019


I'm trying to build 1.1.1b on an old RHEL 5.5 machine (for reasons too tiresome to explain). It has a rather ancient version of the Gnu assembler, 2.17.50, which ghash-x86_64.pl decides means it doesn't have AVX support. (The script looks for 2.20 or later, basically. I assume that's correct.)

The problem is that it generates invalid assembly when AVX isn't available. The output from the assembler is:

-----
crypto/modes/ghash-x86_64.s: Assembler messages:
crypto/modes/ghash-x86_64.s:1311: Error: previous CFI entry not closed (missing .cfi_endproc)
crypto/modes/ghash-x86_64.s:1374: Error: open CFI at the end of file; missing .cfi_endproc directive
-----

Looking at ghash-x86_64.s, I can see that indeed there's no .cfi_endproc before line 1311. gcm_init_avx is missing its endproc. And looking at the script, the reason seems obvious, unless I'm missing something:

-----
$code.=<<___;
.globl   gcm_init_avx
.type gcm_init_avx,\@abi-omnipotent
.align   32
gcm_init_avx:
.cfi_startproc
___
if ($avx) {
...
$code.=<<___;
   ret
.cfi_endproc
.size gcm_init_avx,.-gcm_init_avx
___
} else {
$code.=<<___;
   jmp   .L_init_clmul
.size gcm_init_avx,.-gcm_init_avx
___
}
----

There's a .cfi_endproc in the here-doc on the if ($avx) branch, but none in the here-doc on the else branch. So if the assembler doesn't have AVX support, the script doesn't emit the .cfi_endproc directive.

Same thing with gcm_ghash_avx.

Is this a bug in ghash-x86_64.pl, or am I misinterpreting?

I've just started looking at this, so apologies if it's a known issue that's already been fixed in a later release or on the master.

Thanks,
Michael Wojcik
Distinguished Engineer, Micro Focus





More information about the openssl-users mailing list