Page MenuHomeFreeBSD

ossl: port to arm64
ClosedPublic

Authored by mhorne on Nov 26 2020, 8:41 PM.
Tags
None
Referenced Files
F102006079: D27390.diff
Wed, Nov 6, 11:20 AM
Unknown Object (File)
Sun, Nov 3, 4:40 PM
Unknown Object (File)
Sat, Oct 26, 3:46 PM
Unknown Object (File)
Fri, Oct 18, 5:04 AM
Unknown Object (File)
Fri, Oct 18, 5:03 AM
Unknown Object (File)
Fri, Oct 18, 5:03 AM
Unknown Object (File)
Fri, Oct 18, 5:03 AM
Unknown Object (File)
Fri, Oct 18, 5:03 AM
Subscribers

Details

Reviewers
jhb
jkim
andrew
jmg
Group Reviewers
manpages
Commits
rS368350: ossl: port to arm64
Summary

Enable in-kernel acceleration of SHA1 and SHA2 operations on arm64 by adding
support for the ossl(4) crypto driver. This uses OpenSSL's assembly routines
under the hood, which will take advantage of SHA intrinsics if present.

Test Plan

Compile as module and included in kernel config.

Verified using cryptotest.py and cryptocheck -a hash,mac -d ossl -z.

Diff Detail

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 35064
Build 32039: arc lint + arc unit

Event Timeline

sys/conf/files.arm64
249–259

probably we want to move these to generic files
I did this for vmware pv drivers in rS366726 for arm64

sys/modules/Makefile
809–810

this case exists at line 498 already
(this file is a mess)

Address emaste's comments. Update cryptotest.py to test ossl on arm64.

mhorne added inline comments.
sys/conf/files.arm64
249–259

Thanks, I updated D27388 to move the common files to sys/conf/files.

See my one caveat on the x86 review about where to put the cpuid file. Looks great in general. The arm cpuid bits are so much simpler. :)

sys/modules/ossl/Makefile
24

Adding to OBJS unconditionally here won't work on x86? I think you can still make this 'SRCS.aarch64' and list the S files. You might have to put the build rule for the armv8 object files below the include, and/or use something like:

${SRCS.aarch64:S/S/o}: ${.TARGET:R}.S

or perhaps more readable (but verbose):

.for f in ${SRCS.aarch64}
${f:R}.o: ${f}
       ${CC} ...
.endfor
mhorne marked an inline comment as done.

Move cpuid file. Improve Makefile logic.

There's one remaining issue I discovered, the generated assembly files want to include the arm_arch.h header. I'm thinking the best solution is to copy this header into the ossl source files rather than modifying the generated files or including it from userland sources. Thoughts?

sys/modules/ossl/Makefile
24

Thank you, I had somehow convinced myself that adding these to SRCS.aarch64 didn't work, but it seems it did after all. make is hard :/

mhorne marked an inline comment as done.

Include a copy of arm_arch.h, required by the assembly routines.

Fix a copy-paste error: ARMV8_AES -> ARMV8_SHA1

arm_arch.h looks ok to me the way you've done it (copy).

sys/modules/ossl/Makefile
43

Hmmm, this might need an extra :M*.S to not generate a rule for ossl_arch64.c.

Fix make rule to cover .S files only.

mhorne added inline comments.
sys/modules/ossl/Makefile
42

"filesto" to be fixed before committing.

This revision is now accepted and ready to land.Dec 4 2020, 6:18 PM
This revision was automatically updated to reflect the committed changes.