Port-i386 archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: How to re-compile sshd for a 386
On Fri, 1 Aug 2025, Greg Troxel wrote:
Beware that openssl has a habit of trying instructions, catching faults,
and using them if they work. At least I noticed this on earmv7. That
may have something to do with this.
Not on x86. It does that on ARM, PPC, S390x and SPARCv8. On x86 it relies on
the CPUID instruction, which would be a problem on any x86 below Pentium.
On Fri, 1 Aug 2025, Mark Ter Morshuizen wrote:
The only problem I have is that when the system starts up sshd fails with
"illegal instruction" and does not start.
Prolly when executing the CPUID or MMX/SSE code in libcrypto.so. What branch is
this source from?
Is there a way to recompile the built in (not a package) sshd so that it runs
on the 386?
You'll have to pass the `-march=i386' flag to GCC and use the portable C
routines in libcrypto instead of the preferred faster assembly code.
For example in -HEAD, see:
```
$ egrep -r '(CPUID|_ASM)' /usr/src/crypto/external/bsd/openssl/lib/libcrypto/
/usr/src/crypto/external/bsd/openssl/lib/libcrypto/crypto.inc:.if !defined(CPUID)
/usr/src/crypto/external/bsd/openssl/lib/libcrypto/crypto.inc:CRYPTO_SRCS+= ${CPUID_SRCS}
/usr/src/crypto/external/bsd/openssl/lib/libcrypto/engine.inc:.if !defined(CPUID)
/usr/src/crypto/external/bsd/openssl/lib/libcrypto/engine.inc:CRYPTOCPPFLAGS+=-DNEED_CPUID_SETUP
[...]
/usr/src/crypto/external/bsd/openssl/lib/libcrypto/arch/arm/sha.inc:SHACPPFLAGS = -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DKECCAK1600_ASM
/usr/src/crypto/external/bsd/openssl/lib/libcrypto/arch/i386/aes.inc:AESCPPFLAGS = -DAES_ASM -DOPENSSL_IA32_SSE2
/usr/src/crypto/external/bsd/openssl/lib/libcrypto/arch/i386/bn.inc:BNCPPFLAGS+= -DOPENSSL_BN_ASM_PART_WORDS
/usr/src/crypto/external/bsd/openssl/lib/libcrypto/arch/i386/crypto.inc:CPUID_SRCS = x86cpuid.S
/usr/src/crypto/external/bsd/openssl/lib/libcrypto/arch/i386/crypto.inc:CPUID = yes
/usr/src/crypto/external/bsd/openssl/lib/libcrypto/arch/i386/crypto.inc:CPPFLAGS += -DOPENSSL_CPUID_OBJ
/usr/src/crypto/external/bsd/openssl/lib/libcrypto/arch/i386/ec.inc:ECCPPFLAGS+= -DECP_NISTZ256_ASM
/usr/src/crypto/external/bsd/openssl/lib/libcrypto/arch/i386/modes.inc:MODESCPPFLAGS = -DGHASH_ASM -DOPENSSL_IA32_SSE2
/usr/src/crypto/external/bsd/openssl/lib/libcrypto/arch/i386/poly1305.inc:POLY1305_CPPFLAGS+=-DPOLY1305_ASM
[...]
$
```
(I have the same 4.0.1 release on a virtual machine. How do I
make it compile sshd for the 386 and not for itself? Preferably without
having to build the entire system.)
It's a pain, but, it can be done. You'll have to compile everything OpenSSH
depends on first, then sshd itself with `-march=i386'. I did this awhile back
but never wrote down the exact commands--but it's easy enough to recreate...
-RVP
Home |
Main Index |
Thread Index |
Old Index