PeterMosmans / openssl

'Extra featured' OpenSSL with ChaCha20 and Poly1305 support
https://onwebsecurity.com/pages/openssl.html
Other
92 stars 18 forks source link

Assembler error under Ubuntu 12.04 LTS ./ Debian wheezy #7

Closed drwetter closed 9 years ago

drwetter commented 9 years ago

Hi Peter,

I got the following error while compiling:

gcc -I.. -I../.. -I../modes -I../asn1 -I../evp -I../../include  -DZLIB -DOPENSSL_THREADS   -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -static -Wa,--noexecstack -m64 -DL_ENDIAN -DTERMIO -O3 -Wall -DOPENSSL_EXPERIMENTAL_JPAKE -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -c  -o ecp_nistz256-x86_64.o ecp_nistz256-x86_64.s
ecp_nistz256-x86_64.s: Assembler messages:
ecp_nistz256-x86_64.s:853: Error: no such instruction: `adcxq %rcx,%r9'
ecp_nistz256-x86_64.s:854: Error: no such instruction: `adoxq %rbp,%r10'
ecp_nistz256-x86_64.s:857: Error: no such instruction: `adcxq %rcx,%r10'
ecp_nistz256-x86_64.s:858: Error: no such instruction: `adoxq %rbp,%r11'
[..]
ecp_nistz256-x86_64.s:1041: Error: no such instruction: `adoxq %rax,%r15'
make[2]: *** [ecp_nistz256-x86_64.o] Error 1
make[2]: Leaving directory `/home/dirkw/openssl-1.0.2.pm/crypto/ec'
make[1]: *** [subdirs] Error 1
make[1]: Leaving directory `/home/dirkw/openssl-1.0.2.pm/crypto'
make: *** [build_crypto] Error 1

It does not happen with newer Linux distros (e.g. opensuse 13.1) under 64 Bit. And: vanilla 1.0.2 compiles fine under both distros.

The assembler file in question (ecp_nistz256-x86_64.s) contains those instructions -- as opposed to the vanilla tree. Is that only for newer assemblers?

PeterMosmans commented 9 years ago

Thanks for reporting, I'm going to look into it.

PeterMosmans commented 9 years ago

Hi @drwetter , The assembly file you mention is generated automatically by https://github.com/PeterMosmans/openssl/blob/1.0.2-chacha/crypto/ec/asm/ecp_nistz256-x86_64.pl which is the same as the vanilla one ? Did you perform a make dclean; make clean before building ?

Cheers,

Peter

drwetter commented 9 years ago

Hi @PeterMosmans,

thx for getting back on this. Just to make sure I just did a make dclean on the existing tree, also a fresh clone of the repository. Unfortunately with the same result.

[..]
gcc -I.. -I../.. -I../modes -I../asn1 -I../evp -I../../include  -DZLIB -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -static -Wa,--noexecstack -m64 -DL_ENDIAN -DTERMIO -O3 -Wall -DOPENSSL_EXPERIMENTAL_JPAKE -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM -DECP_NISTZ256_ASM   -c -o  ecp_nistz256.o ecp_nistz256.c
gcc -I.. -I../.. -I../modes -I../asn1 -I../evp -I../../include  -DZLIB -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -static -Wa,--noexecstack -m64 -DL_ENDIAN -DTERMIO -O3 -Wall -DOPENSSL_EXPERIMENTAL_JPAKE -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -c  -o  ecp_nistz256-x86_64.o ecp_nistz256-x86_64.s
ecp_nistz256-x86_64.s: Assembler messages:
ecp_nistz256-x86_64.s:853: Error: no such instruction: `adcxq %rcx,%r9'
ecp_nistz256-x86_64.s:854: Error: no such instruction: `adoxq %rbp,%r10'
ecp_nistz256-x86_64.s:857: Error: no such instruction: `adcxq %rcx,%r10'
[..]
ecp_nistz256-x86_64.s:1035: Error: no such instruction: `adoxq %rbp,%r13'
ecp_nistz256-x86_64.s:1039: Error: no such instruction: `adoxq %rcx,%r14'
ecp_nistz256-x86_64.s:1041: Error: no such instruction: `adoxq %rax,%r15'
make[2]: *** [ecp_nistz256-x86_64.o] Error 1
make[2]: Leaving directory `/home/<abcd>/openssl-1.0.2.pm/crypto/ec'
make[1]: *** [subdirs] Error 1
make[1]: Leaving directory `/home/<abcd>/openssl-1.0.2.pm/crypto'
make: *** [build_crypto] Error 1
promptA% as --version
GNU assembler (GNU Binutils for Ubuntu) 2.22
Copyright 2011 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or later.
This program has absolutely no warranty.
This assembler was configured for a target of `x86_64-linux-gnu'.
promptA% cat /etc/os-release   
NAME="Ubuntu"
VERSION="12.04.5 LTS, Precise Pangolin"
ID=ubuntu
ID_LIKE=debian
 PRETTY_NAME="Ubuntu precise (12.04.5 LTS)"
 VERSION_ID="12.04"

It does work on newer systems though:

promptB%    as --version                             
GNU assembler (GNU Binutils; openSUSE 12.3) 2.23.1
Copyright 2012 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or later.
This program has absolutely no warranty.
This assembler was configured for a target of `x86_64-suse-linux'.
prompt% cat /etc/os-release           
NAME=openSUSE
VERSION="12.3 (Dartmouth)"
VERSION_ID="12.3"
PRETTY_NAME="openSUSE 12.3 (Dartmouth) (x86_64)"
ID=opensuse
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:opensuse:opensuse:12.3"

and

promptC%  as --version
GNU assembler (GNU Binutils for Debian) 2.24.90.20141023
Copyright (C) 2014 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or later.
This program has absolutely no warranty.
This assembler was configured for a target of `x86_64-linux-gnu'.
promptC% at /etc/os-release
PRETTY_NAME="Debian GNU/Linux 8 (jessie)"
NAME="Debian GNU/Linux"
VERSION_ID="8"
VERSION="8 (jessie)"
ID=debian
HOME_URL="http://www.debian.org/"
SUPPORT_URL="http://www.debian.org/support/"
BUG_REPORT_URL="https://bugs.debian.org/"

Please note that the vanilla 1.0.2 works w/o problems on the Ubuntu system above. So my educated guess is that there's a descrepancy in the assembler code between your and the vanilla branch which the old as doesn't support.

Cheers, Dirk

PeterMosmans commented 9 years ago

Hmmm, this could be due to several factors. Really weird that this part gives discrepancies, as I'm not touching/modifying assembly at all. I added the bug label, but I'm going to put it on the backburner and give other issues priority. If I wait another 2 months then your distro is unsupported :) (kidding)

drwetter commented 9 years ago

not 2 months, but two years ;-) -- at least as Ubuntu 12.04 is concerned

I need to use older distributions because of backwards compatibilty. If supply binaries compiled under a recent distro they don't run under older ones. Ubuntu LTS is a good choice for this.

PeterMosmans commented 9 years ago

Hi @drwetter , could you test the latest (1f68654) build ? I took the time to compare the vanilla 1.0.2 version with the chacha branch and found a minor difference in one assembly file...

Thanks!

drwetter commented 9 years ago

Am 10. März 2015 11:34:53 GMT+04:00, schrieb Peter Mosmans notifications@github.com:

Hi @drwetter , could you test the latest (1f68654) build ? I took the time to compare the vanilla 1.0.2 version with the chacha branch and found a minor difference in one assembly file...

Thx, Peter. Will do but give me a few days.

Cheers, Dirk

drwetter commented 9 years ago

78afc5dbe1cd0033ebd8afbc372ada005be315b2 works! Thx, Peter.