Port-sparc archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: OpenSSL issues with 9.2



Hello all,

On Thu, 8 Jul 2021 00:10:56 -0400,
Michael <macallan%netbsd.org@localhost> wrote:

>> > sparcy# ssh-keygen
>> > Generating public/private rsa key pair.
>> > assertion "(*wnumtop) == 0" failed: file "/usr/src/crypto/external/bsd/openssl/dist/crypto/bn/bn_div.c?, 
>> > line 439, function "bn_div_f"
>> > [1]   Abort trap (core dumped) ssh-keygen  
>> 
>> I tried on a JavaStation Krups and it works just fine there, which matches
>> Greg's test on qemu - so it may be CPU dependent.
>> 
>> I don't have any working sun4c to test locally unfortunately.
> 
> For the record, I get this exact failure on my 2xSM81 SS20 when trying
> to start sshd. I don't remember if the MS-II in the sparcbook triggered
> it and I can try some hypersparcs if needed.

I found a change in src/crypto/external/bsd/openssl/lib/libcrypto/arch/sparc/bn.inc
caused the failure. On NetBSD 9.2 source tree, I could build working
libcrypto.so.14.0 when bc.inc obtained from 9.1 is used.

--- bn.inc-9.1  2021-07-13 15:02:58.853763000 +0900
+++ bn.inc-9.2  2021-07-13 13:00:08.296180000 +0900
@@ -1,6 +1,5 @@
-.if ${MACHINE} == "sparc64"
 .PATH.S: ${.PARSEDIR}
 # XXX bn-sparcv8plus.S doesn't work well. why?
 BN_SRCS = bn-sparcv8.S
-.endif
+AFLAGS.bn-sparcv8.S+= -Wa,-Av9
 .include "../../bn.inc"

bn-sparcv8.S is used always in 9.2 for sun4m and sun4c, and,
bn-sparcv8.S should work correctly in 32 bit CPUs according
to comments in OpenSSL's sparcv8plus.S. bn-sparcv8.S and
OpenSSL's sparcv8.S have no difference.

I don't know why bn-sparcv8.S does not work in some people's
sun4m and sun4c. This is beyond my power.

So, I changed bn.inc to avoid to use bn-sparc.S in sun4m and sun4c
as following, this works well in my SS20:
---8<-------8<----
.if ${MACHINE} == "sparc64"
.PATH.S: ${.PARSEDIR}
# XXX bn-sparcv8plus.S doesn't work well. why?
BN_SRCS = bn-sparcv8.S
AFLAGS.bn-sparcv8.S+= -Wa,-Av9
.endif
.include "../../bn.inc"
---8<-------8<----


In addition, crypto.inc also has similar change that
.if ${MACHINE} == "sparc64" is removed and some sparcv9 codes
are used, however, this seem to have no bad effect at least
in the SS20.



Lecturer / Faculty of Software & Info. Sci., Iwate Prefectural Univ., Japan
Nobuyoshi Sato, Ph.D / nobu-s%iwate-pu.ac.jp@localhost / +81-19-694-2612


Home | Main Index | Thread Index | Old Index