Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
ci:
runs-on: ubuntu-latest
container:
image: ghcr.io/tillitis/tkey-builder:4
image: ghcr.io/tillitis/tkey-builder:5rc2
steps:
- name: checkout
uses: actions/checkout@v4
Expand Down
7 changes: 7 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# Release notes

## Upcoming

- Detect new Castor USB VID/PID and older TKey models.
- Include helpful list of UDI Product ID.
- Update x/crypto to v0.40.0.

## v1.1.0

- Change license to BSD-2-Clause
- Follow REUSE specification, see https://reuse.software/
- Return payload even if NOK is set in header
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
module github.com/tillitis/tkeyclient

go 1.21
go 1.23.0

require (
github.com/ccoveille/go-safecast v1.1.0
go.bug.st/serial v1.6.2
golang.org/x/crypto v0.22.0
golang.org/x/crypto v0.40.0
)

require (
github.com/creack/goselect v0.1.2 // indirect
github.com/stretchr/testify v1.8.0 // indirect
golang.org/x/sys v0.19.0 // indirect
golang.org/x/sys v0.34.0 // indirect
)
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PK
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
go.bug.st/serial v1.6.2 h1:kn9LRX3sdm+WxWKufMlIRndwGfPWsH1/9lCWXQCasq8=
go.bug.st/serial v1.6.2/go.mod h1:UABfsluHAiaNI+La2iESysd9Vetq7VRdpxvjx7CmmOE=
golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30=
golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M=
golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o=
golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/crypto v0.40.0 h1:r4x+VvoG5Fm+eJcxMaY8CQM7Lb0l1lsmjGBQ6s8BfKM=
golang.org/x/crypto v0.40.0/go.mod h1:Qr1vMER5WyS2dfPHAlsOj01wgLbsyWtFn/aY+5+ZdxY=
golang.org/x/sys v0.34.0 h1:H5Y5sJ2L2JRdyv7ROF1he/lPdvFsd0mJHFw2ThKHxLA=
golang.org/x/sys v0.34.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
Expand Down
13 changes: 10 additions & 3 deletions ports.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ import (
)

const (
tillitisUSBVID = "1207"
tillitisUSBPID = "8887"
tillitisMTAUSBV1VID = "1207"
tillitisMTAUSBV1PID = "8887"
tillitisTKEYUSBV2VID = "1209"
tillitisTKEYUSBV2PID = "8885"
// Custom errors
ErrNoDevice = constError("no TKey connected")
ErrManyDevices = constError("more than one TKey connected")
Expand All @@ -23,6 +25,11 @@ type SerialPort struct {
SerialNumber string
}

func isTKey(vid string, pid string) bool {
return (vid == tillitisMTAUSBV1VID && pid == tillitisMTAUSBV1PID) ||
(vid == tillitisTKEYUSBV2VID && pid == tillitisTKEYUSBV2PID)
}

// DetectSerialPort tries to detect an inserted TKey and returns the
// device path if successful.
func DetectSerialPort(verbose bool) (string, error) {
Expand Down Expand Up @@ -65,7 +72,7 @@ func GetSerialPorts() ([]SerialPort, error) {
return ports, nil
}
for _, port := range portDetails {
if port.IsUSB && port.VID == tillitisUSBVID && port.PID == tillitisUSBPID {
if port.IsUSB && isTKey(port.VID, port.PID) {
ports = append(ports, SerialPort{port.Name, port.SerialNumber})
}
}
Expand Down
6 changes: 6 additions & 0 deletions tkeyclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ const (

// Size of RAM in the TKey. See TK1_APP_MAX_SIZE in tk1_mem.h
AppMaxSize = 0x20000

// UDI Product IDs
UDIPIDEngSample = 0 // XXX Also used for development purposes
UDIPIDAcrab = 1
UDIPIDBellatrix = 2
UDIPIDCastor = 3
)

// TillitisKey is a serial connection to a TKey and the commands that
Expand Down