Hello,

The following diff enables FIDO/U2F keys on riscv64.

I've tested this with a Yubikey 5 Nano and was able to successfully
generate an ed25519-sk key pair with ssh-keygen (which is my usecase):

icarus$ uname -a
OpenBSD icarus.fagg.id.au 7.0 GENERIC.MP#1 riscv64
icarus$ ssh-keygen -t ed25519-sk 
Generating public/private ed25519-sk key pair.
You may need to touch your authenticator to authorize key generation.
Enter file in which to save the key (/home/fagg/.ssh/id_ed25519_sk): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/fagg/.ssh/id_ed25519_sk
Your public key has been saved in /home/fagg/.ssh/id_ed25519_sk.pub

If there's anything else I should test please let me know.

Thanks,

Ash

Index: sys/arch/riscv64/conf/GENERIC
===================================================================
RCS file: /cvs/src/sys/arch/riscv64/conf/GENERIC,v
retrieving revision 1.29
diff -u -p -u -p -r1.29 GENERIC
--- sys/arch/riscv64/conf/GENERIC       2 Sep 2021 10:11:21 -0000       1.29
+++ sys/arch/riscv64/conf/GENERIC       30 Nov 2021 01:58:44 -0000
@@ -133,6 +133,8 @@ uwacom*             at uhidev?              # USB Wacom 
tablet
 wsmouse*       at uwacom? mux 0
 ukbd*          at uhidev?
 wskbd*         at ukbd? mux 1
+uhid*          at uhidev?              # USB generic HID support
+fido*          at uhidev?              # FIDO/U2F security key support
 udl*           at uhub?                # DisplayLink USB displays
 wsdisplay*     at udl?
 umass*         at uhub?
Index: sys/arch/riscv64/riscv64/conf.c
===================================================================
RCS file: /cvs/src/sys/arch/riscv64/riscv64/conf.c,v
retrieving revision 1.12
diff -u -p -u -p -r1.12 conf.c
--- sys/arch/riscv64/riscv64/conf.c     11 Nov 2021 10:03:09 -0000      1.12
+++ sys/arch/riscv64/riscv64/conf.c     30 Nov 2021 01:58:44 -0000
@@ -91,6 +91,8 @@ cdev_decl(lpt);
 #include "radio.h"
 #include "drm.h"
 cdev_decl(drm);
+#include "uhid.h"
+#include "fido.h"
 
 #include "wsdisplay.h"
 #include "wskbd.h"
@@ -178,7 +180,7 @@ struct cdevsw       cdevsw[] =
        cdev_notdef(),                  /* 60: i4b phone device */
        /* End of reserved slots for isdn4bsd. */
        cdev_notdef(),                  /* 61: USB controller */
-       cdev_notdef(),                  /* 62: USB generic HID */
+       cdev_usbdev_init(NUHID,uhid),   /* 62: USB generic HID */
        cdev_notdef(),                  /* 63: USB generic driver */
        cdev_notdef(),                  /* 64: USB printers */
        cdev_notdef(),                  /* 65: urio */
@@ -219,7 +221,7 @@ struct cdevsw       cdevsw[] =
        cdev_notdef(),                  /* 95 */
        cdev_ipmi_init(NIPMI,ipmi),     /* 96: ipmi */
        cdev_notdef(),                  /* 97: was switch(4) */
-       cdev_notdef(),                  /* 98: FIDO/U2F security key */
+       cdev_fido_init(NFIDO,fido),     /* 98: FIDO/U2F security key */
        cdev_pppx_init(NPPPX,pppac),    /* 99: PPP Access Concentrator */
        cdev_notdef(),                  /* 100: USB joystick/gamecontroller */
 };


Reply via email to