From 8c9412983d21dc0cf8f46c92311d180891e73719 Mon Sep 17 00:00:00 2001 From: Alex Dupre Date: Wed, 3 Oct 2018 10:58:17 +0000 Subject: [PATCH] Update to post 2.0.24 release. --- security/trezord/Makefile | 6 +-- security/trezord/distinfo | 6 +-- .../trezord/files/extra-patch-usb_libusb.go | 38 ++++++++++++++ .../trezord/files/extra-patch-usb_webusb.go | 52 ------------------- 4 files changed, 44 insertions(+), 58 deletions(-) create mode 100644 security/trezord/files/extra-patch-usb_libusb.go delete mode 100644 security/trezord/files/extra-patch-usb_webusb.go diff --git a/security/trezord/Makefile b/security/trezord/Makefile index 3f0cf27595fa..af0963d031da 100644 --- a/security/trezord/Makefile +++ b/security/trezord/Makefile @@ -2,8 +2,9 @@ # $FreeBSD$ PORTNAME= trezord -PORTVERSION= 2.0.23 DISTVERSIONPREFIX= v +DISTVERSION= 2.0.24-5 +DISTVERSIONSUFFIX= -gf593bf3 CATEGORIES= security MAINTAINER= ale@FreeBSD.org @@ -18,14 +19,13 @@ USE_GITHUB= yes GH_ACCOUNT= trezor GH_PROJECT= ${PORTNAME}-go GO_PKGNAME= github.com/${GH_ACCOUNT}/${GH_PROJECT} -GH_TAGNAME= 0e82873 PLIST_FILES= bin/${GH_PROJECT} .include .if ${OPSYS} == FreeBSD && ${OSVERSION} < 1102000 -EXTRA_PATCHES+= ${FILESDIR}/extra-patch-usb_webusb.go +EXTRA_PATCHES+= ${FILESDIR}/extra-patch-usb_libusb.go .endif .include diff --git a/security/trezord/distinfo b/security/trezord/distinfo index c1268bc18e35..7dc2682880dd 100644 --- a/security/trezord/distinfo +++ b/security/trezord/distinfo @@ -1,3 +1,3 @@ -TIMESTAMP = 1537790982 -SHA256 (trezor-trezord-go-v2.0.23-0e82873_GH0.tar.gz) = 87f359982952429d4f8303966ce750985fb1be484e3ee22ed636594b0dcc4345 -SIZE (trezor-trezord-go-v2.0.23-0e82873_GH0.tar.gz) = 954886 +TIMESTAMP = 1538563785 +SHA256 (trezor-trezord-go-v2.0.24-5-gf593bf3_GH0.tar.gz) = c246624c7456e313e9900fb304fc427608c43352f0c5622adb1be32f97912b81 +SIZE (trezor-trezord-go-v2.0.24-5-gf593bf3_GH0.tar.gz) = 955195 diff --git a/security/trezord/files/extra-patch-usb_libusb.go b/security/trezord/files/extra-patch-usb_libusb.go new file mode 100644 index 000000000000..9918e32c7c4c --- /dev/null +++ b/security/trezord/files/extra-patch-usb_libusb.go @@ -0,0 +1,38 @@ +--- usb/libusb.go.orig 2018-10-01 19:43:54 UTC ++++ usb/libusb.go +@@ -3,6 +3,7 @@ package usb + import ( + "encoding/hex" + "fmt" ++ "runtime" + "strings" + "sync" + "sync/atomic" +@@ -311,13 +312,21 @@ func (b *LibUSB) matchVidPid(vid uint16, + } + + func (b *LibUSB) identify(dev lowlevel.Device) string { +- var ports [8]byte +- p, err := lowlevel.Get_Port_Numbers(dev, ports[:]) +- if err != nil { +- b.mw.Println(fmt.Sprintf("libusb - identify - error getting port numbers %s", err.Error())) +- return "" ++ var path string ++ if runtime.GOOS != "freebsd" { ++ var ports [8]byte ++ p, err := lowlevel.Get_Port_Numbers(dev, ports[:]) ++ if err != nil { ++ b.mw.Println(fmt.Sprintf("webusb - identify - error getting port numbers %s", err.Error())) ++ return "" ++ } ++ path = hex.EncodeToString(p) ++ } else { ++ bn := lowlevel.Get_Bus_Number(dev) ++ da := lowlevel.Get_Device_Address(dev) ++ path = fmt.Sprintf("%02x%02x", bn, da) + } +- return libusbPrefix + hex.EncodeToString(p) ++ return libusbPrefix + path + } + + type WUD struct { diff --git a/security/trezord/files/extra-patch-usb_webusb.go b/security/trezord/files/extra-patch-usb_webusb.go deleted file mode 100644 index ac3f2ae34e10..000000000000 --- a/security/trezord/files/extra-patch-usb_webusb.go +++ /dev/null @@ -1,52 +0,0 @@ ---- usb/webusb.go.orig 2018-09-21 13:31:27 UTC -+++ usb/webusb.go -@@ -274,13 +274,21 @@ func (b *WebUSB) matchVidPid(vid uint16, - } - - func (b *WebUSB) identify(dev lowlevel.Device) string { -- var ports [8]byte -- p, err := lowlevel.Get_Port_Numbers(dev, ports[:]) -- if err != nil { -- b.mw.Println(fmt.Sprintf("webusb - identify - error getting port numbers %s", err.Error())) -- return "" -+ var path string -+ if runtime.GOOS != "freebsd" { -+ var ports [8]byte -+ p, err := lowlevel.Get_Port_Numbers(dev, ports[:]) -+ if err != nil { -+ b.mw.Println(fmt.Sprintf("webusb - identify - error getting port numbers %s", err.Error())) -+ return "" -+ } -+ path = hex.EncodeToString(p) -+ } else { -+ bn := lowlevel.Get_Bus_Number(dev) -+ da := lowlevel.Get_Device_Address(dev) -+ path = fmt.Sprintf("%02x%02x", bn, da) - } -- return webusbPrefix + hex.EncodeToString(p) -+ return webusbPrefix + path - } - - type WUD struct { -@@ -331,6 +339,12 @@ func (d *WUD) finishReadQueue() { - } - - func (d *WUD) readWrite(buf []byte, endpoint uint8) (int, error) { -+ var timeout uint -+ if runtime.GOOS != "freebsd" { -+ timeout = usbTimeout -+ } else { -+ timeout = 0 -+ } - d.mw.Println("webusb - rw - start") - for { - d.mw.Println("webusb - rw - checking closed") -@@ -343,7 +357,7 @@ func (d *WUD) readWrite(buf []byte, endp - d.mw.Println("webusb - rw - lock transfer mutex") - d.transferMutex.Lock() - d.mw.Println("webusb - rw - actual interrupt transport") -- p, err := lowlevel.Interrupt_Transfer(d.dev, endpoint, buf, usbTimeout) -+ p, err := lowlevel.Interrupt_Transfer(d.dev, endpoint, buf, timeout) - d.transferMutex.Unlock() - d.mw.Println("webusb - rw - single transfer done") -