View | Details | Raw Unified | Return to bug 240476 | Differences between
and this patch

Collapse All | Expand All

(-)security/py-fido2/Makefile (-1 / +3 lines)
Lines 2-7 Link Here
2
2
3
PORTNAME=	fido2
3
PORTNAME=	fido2
4
PORTVERSION=	0.7.0
4
PORTVERSION=	0.7.0
5
PORTREVISION=	1
5
CATEGORIES=	security python
6
CATEGORIES=	security python
6
MASTER_SITES=	CHEESESHOP
7
MASTER_SITES=	CHEESESHOP
7
PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
8
PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
Lines 14-20 Link Here
14
15
15
RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}cryptography>=1.5:security/py-cryptography@${PY_FLAVOR} \
16
RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}cryptography>=1.5:security/py-cryptography@${PY_FLAVOR} \
16
		${PY_ENUM34} \
17
		${PY_ENUM34} \
17
		${PYTHON_PKGNAMEPREFIX}six>=0:devel/py-six@${PY_FLAVOR}
18
		${PYTHON_PKGNAMEPREFIX}six>=0:devel/py-six@${PY_FLAVOR} \
19
		${PYTHON_PKGNAMEPREFIX}uhid-freebsd>=0:devel/py-uhid-freebsd@${PY_FLAVOR}
18
20
19
USES=		python
21
USES=		python
20
USE_PYTHON=	autoplist distutils
22
USE_PYTHON=	autoplist distutils
(-)security/py-fido2/files/patch-fido2___pyu2f_____init____.py (+12 lines)
Line 0 Link Here
1
--- fido2/_pyu2f/__init__.py.orig	2019-09-10 15:15:37 UTC
2
+++ fido2/_pyu2f/__init__.py
3
@@ -47,6 +47,9 @@ def InternalPlatformSwitch(funcname, *args, **kwargs):
4
   elif sys.platform.startswith('darwin'):
5
     from . import macos
6
     clz = macos.MacOsHidDevice
7
+  elif sys.platform.startswith('freebsd'):
8
+    from . import freebsd
9
+    clz = freebsd.FreeBSDHidDevice
10
 
11
   if not clz:
12
     raise Exception('Unsupported platform: ' + sys.platform)
(-)security/py-fido2/files/patch-fido2___pyu2f_freebsd.py (+38 lines)
Line 0 Link Here
1
--- fido2/_pyu2f/freebsd.py.orig	2019-09-10 15:17:18 UTC
2
+++ fido2/_pyu2f/freebsd.py
3
@@ -0,0 +1,35 @@
4
+from __future__ import absolute_import
5
+
6
+import os
7
+import uhid_freebsd
8
+
9
+from . import linux
10
+
11
+class FreeBSDHidDevice(linux.LinuxHidDevice):
12
+  """Implementation of HID device for FreeBSD.
13
+  """
14
+
15
+  @staticmethod
16
+  def Enumerate():
17
+    for dev in uhid_freebsd.enumerate():
18
+      desc = linux.base.DeviceDescriptor()
19
+      desc.path = dev["path"]
20
+      desc.vendor_id = dev["vendor_id"]
21
+      desc.product_id = dev["product_id"]
22
+      desc.product_string = dev["product_desc"]
23
+      fd = os.open(desc.path, os.O_RDONLY)
24
+      linux.ParseReportDescriptor(uhid_freebsd.get_report_data(fd, 3), desc)
25
+      os.close(fd)
26
+      yield desc.ToPublicDict()
27
+
28
+  def __init__(self, path):
29
+    linux.base.HidDevice.__init__(self, path)
30
+    self.dev = os.open(path, os.O_RDWR)
31
+    self.desc = linux.base.DeviceDescriptor()
32
+    self.desc.path = path
33
+    linux.ParseReportDescriptor(uhid_freebsd.get_report_data(self.dev, 3), self.desc)
34
+
35
+  def Write(self, packet):
36
+    """See base class."""
37
+    out = bytes(bytearray([0]*64 + packet))  # Prepend the zero-byte (report ID)
38
+    os.write(self.dev, out)

Return to bug 240476