Page MenuHomeFreeBSD

ossl: port to arm64
ClosedPublic

Authored by mhorne on Nov 26 2020, 8:41 PM.
Tags
None
Referenced Files
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
Unknown Object (File)
Fri, Oct 18, 5:02 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

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

sys/conf/files.arm64
249–259 ↗(On Diff #80039)

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

sys/modules/Makefile
808–809 ↗(On Diff #80039)

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 ↗(On Diff #80039)

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 ↗(On Diff #80042)

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 ↗(On Diff #80042)

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
36 ↗(On Diff #80270)

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
35 ↗(On Diff #80312)

"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.