Tested on macOS Sonoma Developer beta 2 (23A5276g)
- Download openssh-portable source code, install
libcrypto,libfido2; - Configure openssh-portable build system by
./configure # [options].
Patch inworkaround-standalone-libsk.patch.
You may want to add -flto or other flags in CFLAGS:
make libssh.a CFLAGS="-O2 -fPIC"make openbsd-compat/libopenbsd-compat.a CFLAGS="-O2 -fPIC"make sk-usbhid.o CFLAGS="-O2 -DSK_STANDALONE -fPIC"
- Export
LDFLAGS,LIBFIDO2andCCfrom previous generatedMakefile; echo $LIBFIDO2 | xargs ${CC} -shared openbsd-compat/libopenbsd-compat.a sk-usbhid.o libssh.a -O2 -fPIC -o libsk-libfido2.so. You may want to append other flags (for example,-Wl,-dead_strip,-exported_symbol,_sk_\*in macOS).
Don't forget to copy libsk-libfido2.so into /usr/local/lib.
Linked: Yubico/libfido2#464 (comment)