Skip to content

Commit 01c502e

Browse files
authored
NOISSUE - Fix Algo Path (#216)
* fix(algorithm): fix running binary algorithm This is the error ``` "algorithm": executable file not found in $PATH ``` * fix(algorithm): get absolute filepath for all algorithms Signed-off-by: Rodney Osodo <[email protected]> * fix(lint): fix linting errors * refactor: simplify algorithm filename Signed-off-by: Rodney Osodo <[email protected]> --------- Signed-off-by: Rodney Osodo <[email protected]>
1 parent bdbeb4e commit 01c502e

File tree

7 files changed

+24
-17
lines changed

7 files changed

+24
-17
lines changed

agent/service.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"fmt"
1111
"log/slog"
1212
"os"
13+
"path/filepath"
1314
"slices"
1415

1516
"github.com/google/go-sev-guest/client"
@@ -118,7 +119,12 @@ func (as *agentService) Algo(ctx context.Context, algo Algorithm) error {
118119
return ErrHashMismatch
119120
}
120121

121-
f, err := os.Create("algorithm")
122+
currentDir, err := os.Getwd()
123+
if err != nil {
124+
return fmt.Errorf("error getting current directory: %v", err)
125+
}
126+
127+
f, err := os.Create(filepath.Join(currentDir, "algorithm"))
122128
if err != nil {
123129
return fmt.Errorf("error creating algorithm file: %v", err)
124130
}

hal/linux/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# Hardware Abstraction Layer (HAL) for Confidential Computing
2-
Cocos HAL for Linux is framework for building custom in-enclave Linux distribution.
2+
3+
Cocos HAL for Linux is framework for building custom in-enclave Linux distribution.
34

45
## Usage
6+
57
HAL uses [Buildroot](https://buildroot.org/)'s [_External Tree_ mechanism](https://buildroot.org/downloads/manual/manual.html#outside-br-custom) for building custom distro:
68

79
```bash

hal/linux/board/cocos/linux.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,4 @@ CONFIG_PREEMPT=n
6464
CONFIG_PREEMPT_DYNAMIC=n
6565
CONFIG_DEBUG_PREEMPT=n
6666
CONFIG_CGROUP_MISC=y
67-
CONFIG_X86_CPUID=y
67+
CONFIG_X86_CPUID=y

hal/linux/configs/cocos_defconfig

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,13 @@ BR2_PACKAGE_HOST_QEMU=y
4545
BR2_PACKAGE_HOST_QEMU_SYSTEM_MODE=y
4646

4747
# Docker
48-
BR2_PACKAGE_LIBSECCOMP_ARCH_SUPPORTS=y
49-
BR2_PACKAGE_LIBSECCOMP=y
50-
BR2_PACKAGE_CA_CERTIFICATES=y
51-
BR2_PACKAGE_DOCKER_CLI=y
52-
BR2_PACKAGE_DOCKER_COMPOSE=y
53-
BR2_PACKAGE_DOCKER_ENGINE=y
54-
BR2_PACKAGE_CONTAINERD=y
48+
BR2_PACKAGE_LIBSECCOMP_ARCH_SUPPORTS=y
49+
BR2_PACKAGE_LIBSECCOMP=y
50+
BR2_PACKAGE_CA_CERTIFICATES=y
51+
BR2_PACKAGE_DOCKER_CLI=y
52+
BR2_PACKAGE_DOCKER_COMPOSE=y
53+
BR2_PACKAGE_DOCKER_ENGINE=y
54+
BR2_PACKAGE_CONTAINERD=y
5555
BR2_PACKAGE_RUNC=y
5656
BR2_PACKAGE_IPTABLES=y
5757

@@ -61,7 +61,7 @@ BR2_PACKAGE_PYTHON_PIP=y
6161
BR2_PACKAGE_BZIP2=y
6262
BR2_PACKAGE_XZ=y
6363
BR2_PACKAGE_ZIP=y
64-
BR2_PACKAGE_PYTHON3_ZLIB=y
64+
BR2_PACKAGE_PYTHON3_ZLIB=y
6565
BR2_PACKAGE_PYTHON3_XZ=y
6666
BR2_PACKAGE_PYTHON3_BZIP2=y
6767
BR2_INSTALL_LIBSTDCPP=y
@@ -71,4 +71,3 @@ BR2_TOOLCHAIN_BUILDROOT_LIBSTDCPP=y
7171
BR2_PACKAGE_GCC=y
7272
BR2_PACKAGE_GCC_TARGET=y
7373
BR2_PACKAGE_LIBSTDCPP=y
74-

hal/linux/external.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
include $(sort $(wildcard $(BR2_EXTERNAL_COCOS_PATH)/package/*/*.mk))
1+
include $(sort $(wildcard $(BR2_EXTERNAL_COCOS_PATH)/package/*/*.mk))

hal/linux/package/agent/Config.in

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ config BR2_PACKAGE_AGENT
33
default y
44
help
55
Confidential Computing Agent is a state machine capable of
6-
receiving datasets and algorithm, running computations, and
7-
fetching the attestation report from within the
8-
Confidential VM.
6+
receiving datasets and algorithm, running computations, and
7+
fetching the attestation report from within the
8+
Confidential VM.

hal/linux/package/agent/agent.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
AGENT_VERSION = main
88
AGENT_SITE = $(call github,ultravioletrs,cocos,$(AGENT_VERSION))
99

10-
define AGENT_BUILD_CMDS
10+
define AGENT_BUILD_CMDS
1111
$(MAKE) -C $(@D) agent EMBED_ENABLED=$(AGENT_EMBED_ENABLED)
1212
endef
1313

0 commit comments

Comments
 (0)