I have a toolchain from an older piece of hardware (W315 from Moxa), and when I run file
on its library files, I get this:
[bf@localhost arm-linux-gnueabi]$ file /usr/local/arm-linux/lib/libssl.so.0.9.8
/usr/local/arm-linux/lib/libssl.so.0.9.8: ELF 32-bit LSB shared object, ARM, version 1 (ARM), dynamically linked, not stripped
As you can see, this OpenSSL library is quite old and does not support TLSv1.2, which I need (at least). So I am trying to find an ARM binary of that library of a newer version. I have found 1.0.0 from Debian, but that has a little different signature:
[bf@localhost arm-linux-gnueabi]$ file libssl.so.1.0.0
libssl.so.1.0.0: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, BuildID[sha1]=83c83f5d3da36759c7adc837405b28539569d26e, stripped
They are both 32 bit, and ELF, but I am not sure if the "ARM" part is comparable.
Could I use that 1.0.0 library in my application? And if not, what should I look for in searching for the right binary?
Results from cat /proc/cpuinfo
:
root@Moxa:/home/fabs# cat /proc/cpuinfo
Processor : ARM922Tid(wb) rev 1 (v4l)
BogoMIPS : 76.59
Features : swp half thumb
CPU implementer : 0x66
CPU architecture: 4
CPU variant : 0x0
CPU part : 0x526
CPU revision : 1
Cache type : VIVT write-back
Cache clean : cp15 c7 ops
Cache lockdown : format B
Cache format : Harvard
I size : 16384
I assoc : 2
I line length : 16
I sets : 512
D size : 16384
D assoc : 2
D line length : 16
D sets : 512
Hardware : Moxa CPU development platform
Revision : 0000
Serial : 0000000000000000
No, they are not. But You can build a recent/supported/secure version of openssl for your platform by using the following procedure:
# openssl
wget https://www.openssl.org/source/openssl-1.1.1k.tar.gz
tar zxf openssl-1.1.1k.tar.gz
# a toolchain I know is working for arm922t according to gcc documentation
wget "https://releases.linaro.org/components/toolchain/binaries/latest-6/arm-linux-gnueabi/gcc-linaro-6.4.1-2018.05-x86_64_arm-linux-gnueabi.tar.xz" -O gcc-linaro-6.4.1-2018.05-x86_64_arm-linux-gnueabi.tar.xz
mkdir -p /opt/arm/6
tar Jxf gcc-linaro-6.4.1-2018.05-x86_64_arm-linux-gnueabi.tar.xz -C /opt/arm/6
# building
cd openssl-1.1.1k
./Configure linux-generic32 --cross-compile-prefix=/opt/arm/6/gcc-linaro-6.4.1-2018.05-x86_64_arm-linux-gnueabi/bin/arm-linux-gnueabi- --prefix=/opt/openssl-1.1.1k --openssldir=/opt/openssl-1.1.1k
Edit the Makefile
, and replace
CFLAGS=-Wall -O3
by:
CFLAGS=-Wall -O3 -march=armv4t -mcpu=arm922t
Then:
make install
ls -gG /opt/openssl-1.1.1k/bin/
total 576
-rwxr-xr-x 1 6214 Jun 30 12:53 c_rehash
-rwxr-xr-x 1 579740 Jun 30 12:53 openssl
ls -gG /opt/openssl-1.1.1k/lib
total 6432
drwxr-xr-x 2 4096 Jun 30 12:53 engines-1.1
-rw-r--r-- 1 3312034 Jun 30 12:53 libcrypto.a
lrwxrwxrwx 1 16 Jun 30 12:53 libcrypto.so -> libcrypto.so.1.1
-rwxr-xr-x 1 2152072 Jun 30 12:53 libcrypto.so.1.1
-rw-r--r-- 1 603100 Jun 30 12:53 libssl.a
lrwxrwxrwx 1 13 Jun 30 12:53 libssl.so -> libssl.so.1.1
-rwxr-xr-x 1 502704 Jun 30 12:53 libssl.so.1
file /opt/openssl-1.1.1k/bin/openssl
/opt/openssl-1.1.1k/bin/openssl: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.3, for GNU/Linux 2.6.32, BuildID[sha1]=7b0e69c478f4c7390d416247f95ac60d9a632bd8, with debug_info, not stripped
If needed, you can build a static version by adding the -static
option at the end of the configuration command:
./Configure linux-generic32 --cross-compile-prefix=/opt/arm/6/gcc-linaro-6.4.1-2018.05-x86_64_arm-linux-gnueabi/bin/arm-linux-gnueabi- --prefix=/opt/openssl-1.1.1k --openssldir=/opt/openssl-1.1.1k -static