Re: bswap is slow on SPARC

Sad Clouds <[email protected]> Wed, 26 Nov 2025 09:36:13 +0000
Newsgroups gmane.os.netbsd.ports.sparc64,gmane.os.netbsd.ports.sparc
Message-ID <[email protected]>
On Wed, 26 Nov 2025 04:27:00 +0000
Taylor R Campbell <[email protected]> wrote:

> Code implementing cryptographic primitives is fairly costly, to
> verify, test, audit, and maintain it: if you make a mistake --
> especially in a context where there's no opportunity for a noisy
> failure to interoperate -- it could just silently destroy any
> security.  That's why it's important to keep the number of primitives
> low, and risky to adopt nonstandard variants like a big-endian version
> of standard primitives.

OK that makes sense. I think OpenSSL seem to have a number of optimised
variants of AES for SPARC:

src/crypto/external/bsd/openssl/lib/libcrypto/arch/sparc64/aesfx-sparcv9.S
src/crypto/external/bsd/openssl/lib/libcrypto/arch/sparc64/aes-sparcv9.S
src/crypto/external/bsd/openssl/lib/libcrypto/arch/sparc64/aest4-sparcv9.S

although I'm not sure how viable it would be to port some of those to
say src/sys/crypto/aes/arch/sparc64 for example. Are these completely
different and incompatible designs?