Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump tamago 1.23.1 #277

Merged
merged 13 commits into from
Oct 16, 2024
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/pr_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ permissions:
jobs:
build:
env:
TAMAGO_VERSION: 1.22.4
TAMAGO_VERSION: 1.23.1
TAMAGO: /usr/local/tamago-go/bin/go
APPLET_PRIVATE_KEY: /tmp/applet.sec
APPLET_PUBLIC_KEY: /tmp/applet.pub
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.22-bookworm
FROM golang:1.23-bookworm

ARG TAMAGO_VERSION
ARG LOG_ORIGIN
Expand Down
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@
# See the License for the specific language governing permissions and
# limitations under the License.

BUILD_EPOCH := $(shell /bin/date -u "+%s")
BUILD_EPOCH := $(shell date -u "+%s")
BUILD_TAGS = linkramsize,linkramstart,disable_fr_auth,linkprintk
REV = $(shell git rev-parse --short HEAD 2> /dev/null)
GIT_SEMVER_TAG ?= $(shell (git describe --tags --exact-match --match 'v*.*.*' 2>/dev/null || git describe --match 'v*.*.*' --tags 2>/dev/null || git describe --tags 2>/dev/null || echo -n v0.0.${BUILD_EPOCH}+`git rev-parse HEAD`) | tail -c +2 )
SRK_HASH ?=

PROTOC ?= /usr/bin/protoc
PROTOC ?= $(shell which protoc)

TAMAGO_SEMVER = $(shell [ -n "${TAMAGO}" -a -x "${TAMAGO}" ] && ${TAMAGO} version | sed 's/.*go\([0-9]\.[0-9]*\.[0-9]*\).*/\1/')
MINIMUM_TAMAGO_VERSION=1.22.4
MINIMUM_TAMAGO_VERSION=1.23.1

SHELL = /bin/bash
SHELL = /usr/bin/env bash

ifeq ("${DEBUG}","1")
BUILD_TAGS := ${BUILD_TAGS},debug
Expand Down Expand Up @@ -144,7 +144,7 @@ manifest: $(APP)_manifest
proto:
@echo "generating protobuf classes"
-rm -f $(CURDIR)/api/*.pb.go
PATH=$(shell go env GOPATH | awk -F":" '{print $$1"/bin"}') ${PROTOC} --proto_path=$(CURDIR)/api --go_out=$(CURDIR)/api api.proto
PATH=$(shell go env GOPATH | awk -F":" '{print $$1"/bin"}'):${PATH} ${PROTOC} --proto_path=$(CURDIR)/api --go_out=$(CURDIR)/api api.proto

$(APP).bin: CROSS_COMPILE=arm-none-eabi-
$(APP).bin: $(APP).elf
Expand Down
14 changes: 8 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/transparency-dev/armored-witness-os

go 1.22.4
go 1.23.1

require (
github.com/coreos/go-semver v0.3.1
Expand All @@ -12,12 +12,12 @@ require (
github.com/transparency-dev/armored-witness-common v0.0.0-20240313170947-0b19d0fb8b95
github.com/transparency-dev/merkle v0.0.2
github.com/transparency-dev/serverless-log v0.0.0-20231215122707-66f68a7705f5
github.com/usbarmory/GoTEE v0.0.0-20240314122327-40179239ad36
github.com/usbarmory/armory-boot v0.0.0-20230922092524-e66d926bc36c
github.com/usbarmory/GoTEE v0.0.0-20240913144333-7e62563c0628
github.com/usbarmory/armory-boot v0.0.0-20240924115649-09d0327c3c99
github.com/usbarmory/crucible v0.0.0-20240221192724-1595f2219655
github.com/usbarmory/imx-usbnet v0.0.0-20240304152630-ca189bf3b3c1
github.com/usbarmory/imx-usbserial v0.0.0-20230503192150-40b6298b31f8
github.com/usbarmory/tamago v0.0.0-20240321170635-3bf2d607eccb
github.com/usbarmory/tamago v0.0.0-20240924114619-273d67cd811d
golang.org/x/crypto v0.28.0
golang.org/x/mod v0.21.0
google.golang.org/protobuf v1.35.1
Expand All @@ -32,8 +32,10 @@ require (
github.com/pierrec/lz4/v4 v4.1.14 // indirect
github.com/stretchr/testify v1.8.2 // indirect
github.com/transparency-dev/formats v0.0.0-20230920083814-0f75b1d4e813 // indirect
github.com/u-root/u-root v0.11.0 // indirect
golang.org/x/sync v0.6.0 // indirect
github.com/u-root/u-root v0.14.0 // indirect
github.com/u-root/uio v0.0.0-20240209044354-b3d14b93376a // indirect
golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 // indirect
golang.org/x/sync v0.8.0 // indirect
golang.org/x/sys v0.26.0 // indirect
golang.org/x/time v0.5.0 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
Expand Down
24 changes: 14 additions & 10 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -51,27 +51,31 @@ github.com/transparency-dev/merkle v0.0.2 h1:Q9nBoQcZcgPamMkGn7ghV8XiTZ/kRxn1yCG
github.com/transparency-dev/merkle v0.0.2/go.mod h1:pqSy+OXefQ1EDUVmAJ8MUhHB9TXGuzVAT58PqBoHz1A=
github.com/transparency-dev/serverless-log v0.0.0-20231215122707-66f68a7705f5 h1:jD3VKdFO2BKl8PfDSFuMvMoMekqMBPxKgvF1H2FPXTw=
github.com/transparency-dev/serverless-log v0.0.0-20231215122707-66f68a7705f5/go.mod h1:rx4EB9NW4aZFJT5kxf6BWRWbZSThl36jv7O5o5r/qv8=
github.com/u-root/u-root v0.11.0 h1:6gCZLOeRyevw7gbTwMj3fKxnr9+yHFlgF3N7udUVNO8=
github.com/u-root/u-root v0.11.0/go.mod h1:DBkDtiZyONk9hzVEdB/PWI9B4TxDkElWlVTHseglrZY=
github.com/usbarmory/GoTEE v0.0.0-20240314122327-40179239ad36 h1:rZfhjJpgKuwos6KBdHKouDJmYmpV/FJv4q34eIjtPjw=
github.com/usbarmory/GoTEE v0.0.0-20240314122327-40179239ad36/go.mod h1:YlZVucqxy/z5QWKerml3Vm5T14UOzZEs2kXfS1nilx8=
github.com/usbarmory/armory-boot v0.0.0-20230922092524-e66d926bc36c h1:qQL3CljMNrk9TyG8EUvCAPU7/bTVitJMhqlKSNhskis=
github.com/usbarmory/armory-boot v0.0.0-20230922092524-e66d926bc36c/go.mod h1:20DIzHJntbLDOptGT7TOm8DkT5mL2jRyzPzVXAYVHJ8=
github.com/u-root/u-root v0.14.0 h1:Ka4T10EEML7dQ5XDvO9c3MBN8z4nuSnGjcd1jmU2ivg=
github.com/u-root/u-root v0.14.0/go.mod h1:hAyZorapJe4qzbLWlAkmSVCJGbfoU9Pu4jpJ1WMluqE=
github.com/u-root/uio v0.0.0-20240209044354-b3d14b93376a h1:BH1SOPEvehD2kVrndDnGJiUF0TrBpNs+iyYocu6h0og=
github.com/u-root/uio v0.0.0-20240209044354-b3d14b93376a/go.mod h1:P3a5rG4X7tI17Nn3aOIAYr5HbIMukwXG0urG0WuL8OA=
github.com/usbarmory/GoTEE v0.0.0-20240913144333-7e62563c0628 h1:PGlLJYe1YMmzmSYXhEkOSXSrQjV/mXk6CNk5LTgnndM=
github.com/usbarmory/GoTEE v0.0.0-20240913144333-7e62563c0628/go.mod h1:solbXmDpRv6u6CmfHiFi3rwsYoTlZXToith669WnvgM=
github.com/usbarmory/armory-boot v0.0.0-20240924115649-09d0327c3c99 h1:gDYQA/MDwqfTW5kRIqMcZ/rLlMwSyHJ9fIoWDIBCTLw=
github.com/usbarmory/armory-boot v0.0.0-20240924115649-09d0327c3c99/go.mod h1:rhSWQ269NlXN2Nn3qZawWjqXBgbxtnx118RbJ2H6IlQ=
github.com/usbarmory/crucible v0.0.0-20240221192724-1595f2219655 h1:n3JkWqsxKsbX2SKy+ac3v2rgEmTWfA/s0SC5kHlJGBY=
github.com/usbarmory/crucible v0.0.0-20240221192724-1595f2219655/go.mod h1:xEDojciFHw8iteMACinYDeHDn07V9MiS0KO0uCLRRnk=
github.com/usbarmory/imx-usbnet v0.0.0-20240304152630-ca189bf3b3c1 h1:Ba8KE+wt6bvbAqnN0lKjRwtdX6ud8J7Z2X2Ds+crEJQ=
github.com/usbarmory/imx-usbnet v0.0.0-20240304152630-ca189bf3b3c1/go.mod h1:gJsQWSa5rjprEZb8/NqDzoOPxk6LTuEPsPiqpbrEUjw=
github.com/usbarmory/imx-usbserial v0.0.0-20230503192150-40b6298b31f8 h1:VPruqXJEJxTweSRyx3NIkiIqQl9ppZHp4wZnL8+Y0aI=
github.com/usbarmory/imx-usbserial v0.0.0-20230503192150-40b6298b31f8/go.mod h1:XfTrYj8Ik3ljit1cSHTcsXs7lyJ/QMsplPDX8+g5s7c=
github.com/usbarmory/tamago v0.0.0-20220823080407-04f05cf2a5a3/go.mod h1:Lok79mjbJnhoBGqhX5cCUsZtSemsQF5FNZW+2R1dRr8=
github.com/usbarmory/tamago v0.0.0-20240321170635-3bf2d607eccb h1:1G0RMAC/WkYlXfmf8D94bHxhN0WpavtdZ2yJhuSNJ4U=
github.com/usbarmory/tamago v0.0.0-20240321170635-3bf2d607eccb/go.mod h1:uCPXcPo8SZulhZPz8irfVqzwVlPZ45w7CTJxkfxueGA=
github.com/usbarmory/tamago v0.0.0-20240924114619-273d67cd811d h1:rPQ3OVO/SRWviAFLpXO4OUOtTlUH2IIAzZvcWfW9elk=
github.com/usbarmory/tamago v0.0.0-20240924114619-273d67cd811d/go.mod h1:NL88q9ZsIPYFzXaosAeKgu1Kr5i1k4Rau3wnbNBL5bY=
golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw=
golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U=
golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 h1:LfspQV/FYTatPTr/3HzIcmiUFH7PGP+OQ6mgDYo3yuQ=
golang.org/x/exp v0.0.0-20240222234643-814bf88cf225/go.mod h1:CxmFvTBINI24O/j8iY7H1xHzx2i4OsyguNBmN/uPtqc=
golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0=
golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ=
golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ=
golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo=
golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk=
Expand Down
30 changes: 5 additions & 25 deletions trusted_os/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
package main

import (
"fmt"
"log"

"github.com/usbarmory/tamago/arm"
Expand All @@ -38,31 +37,14 @@ var irqHandler = make(map[int]func())
// defined in handler.s
func wakeHandler(g uint32, p uint32)

func isr() (err error) {
irq, end := imx6ul.GIC.GetInterrupt(true)

if end != nil {
close(end)
}
func isr() {
irq := imx6ul.GIC.GetInterrupt(true)

if handle, ok := irqHandler[irq]; ok {
handle()
return nil
}

return fmt.Errorf("unexpected IRQ %d", irq)
}

func handleInterrupts() {
arm.RegisterInterruptHandler()

for {
arm.WaitInterrupt()

if err := isr(); err != nil {
log.Printf("SM IRQ handling error: %v", err)
}
return
}
log.Printf("unexpected IRQ %d", irq)
}

func fiqHandler(ctx *monitor.ExecCtx) (_ error) {
Expand All @@ -79,9 +61,7 @@ func fiqHandler(ctx *monitor.ExecCtx) (_ error) {
return
}

if err := isr(); err != nil {
log.Printf("SM FIQ handling error: %v", err)
}
isr()

// mask FIQs, applet handler will request unmasking when done
bits.Set(&ctx.SPSR, CPSR_FIQ)
Expand Down
3 changes: 2 additions & 1 deletion trusted_os/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
"time"

"github.com/coreos/go-semver/semver"
"github.com/usbarmory/tamago/arm"
usbarmory "github.com/usbarmory/tamago/board/usbarmory/mk2"
"github.com/usbarmory/tamago/soc/nxp/enet"
"github.com/usbarmory/tamago/soc/nxp/imx6ul"
Expand Down Expand Up @@ -259,7 +260,7 @@ func main() {
}

// never returns
handleInterrupts()
arm.ServiceInterrupts(isr)
}

func createBundleVerifier(logOrigin string, logVerifier note.Verifier, manifestVerifiers []string) (firmware.BundleVerifier, error) {
Expand Down
12 changes: 12 additions & 0 deletions trusted_os/mem_bee.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ package main

import (
_ "unsafe"

"github.com/usbarmory/tamago/arm"
"github.com/usbarmory/tamago/soc/nxp/imx6ul"
)

// The following memory regions are within an alias of external DDR, required
Expand Down Expand Up @@ -56,3 +59,12 @@ var ramSize uint32 = secureSize

//go:linkname vecTableStart github.com/usbarmory/tamago/arm.vecTableStart
var vecTableStart uint32 = physicalStart

func init() {
imx6ul.ARM.SetAttribute(
vecTableStart,
vecTableStart + (1 << 20),
arm.TTE_EXECUTE_NEVER,
0,
)
}