Skip to content

Commit

Permalink
Demo FSC integration using the IRB demo (#635)
Browse files Browse the repository at this point in the history
* adding more irb demo files

Signed-off-by: Marcus Brandenburger <bur@zurich.ibm.com>

* Complete IBR flow

Signed-off-by: Marcus Brandenburger <bur@zurich.ibm.com>

* Integrate into FPC build flow

Signed-off-by: Marcus Brandenburger <bur@zurich.ibm.com>
  • Loading branch information
mbrandenburger authored Nov 15, 2021
1 parent d07bc32 commit 0aea62d
Show file tree
Hide file tree
Showing 68 changed files with 8,052 additions and 1 deletion.
3 changes: 3 additions & 0 deletions ecc_enclave/enclave/CMakeLists-common-app-enclave.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ include_directories(
${SGX_SDK}/include
${SGX_SDK}/include/tlibc
${SGX_SDK}/include/libcxx
#following only needed for demo
${SGX_SSL}/include
${COMMON_SOURCE_DIR}/crypto/pdo/common
)

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${SGX_COMMON_CFLAGS} -nostdinc -fno-builtin -fvisibility=hidden -fpie -fstack-protector -std=c11")
Expand Down
2 changes: 1 addition & 1 deletion samples/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
TOP = ..
include $(TOP)/build.mk

SAMPLES = application chaincode #deployment
SAMPLES = application chaincode demos #deployment

build clean:
$(foreach DIR, $(SAMPLES), $(MAKE) -C $(DIR) $@ || exit;)
Expand Down
13 changes: 13 additions & 0 deletions samples/demos/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright 2019 Intel Corporation
# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0

TOP = ../..
include $(TOP)/build.mk

DEMOS = irb

build clean:
$(foreach DIR, $(DEMOS), $(MAKE) -C $(DIR) $@ || exit;)

2 changes: 2 additions & 0 deletions samples/demos/irb/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
cmd/**
users/**
21 changes: 21 additions & 0 deletions samples/demos/irb/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0

TOP = ../../..
include $(TOP)/build.mk

COMPONENTS = chaincode experimenter

all: build test

build:
$(foreach DIR, $(COMPONENTS), $(MAKE) -C $(DIR) $@ || exit;)

test:
$(GO) test -v ./...

clean:
$(GO) clean
rm -rf cmd users
$(foreach DIR, $(COMPONENTS), $(MAKE) -C $(DIR) $@ || exit;)
10 changes: 10 additions & 0 deletions samples/demos/irb/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# IRB approval sample

Get redis
```bash
docker pull redis:latest
```

```bash
make build test
```
3 changes: 3 additions & 0 deletions samples/demos/irb/chaincode/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# SPDX-License-Identifier: Apache-2.0
_protos/**
_build/**
32 changes: 32 additions & 0 deletions samples/demos/irb/chaincode/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Copyright 2019 Intel Corporation
# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0

cmake_minimum_required(VERSION 3.5.1)
project(FPC_DEMO_EAS)

set(SOURCE_FILES
entry.cpp
dispatcher.cpp
chaincode.cpp
errors.cpp
messages.cpp
_protos/irb.pb.c
storage.cpp
id.cpp
experiment.cpp
study.cpp
signedapproval.cpp
evaluationpack.cpp
)

# NANOPB for protos
include($ENV{FPC_PATH}/cmake/NanoPB.cmake)
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
${NANOPB_PATH}
)

# FPC Common chaincode
include($ENV{FPC_PATH}/ecc_enclave/enclave/CMakeLists-common-app-enclave.txt)
48 changes: 48 additions & 0 deletions samples/demos/irb/chaincode/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Copyright 2019 Intel Corporation
# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0

TOP = ../../../..
include $(TOP)/build.mk

BUILD_DIR := _build
DOCKER_IMAGE_NAME := fpc/irb-experiment

all: docker

$(BUILD_DIR):
@if [ ! -d $(BUILD_DIR) ]; then \
mkdir -p $(BUILD_DIR) && \
cd $(BUILD_DIR) && \
cmake ./..; \
fi

build: protos $(BUILD_DIR)
$(MAKE) --directory=$(BUILD_DIR)

clean: protos-clean
rm -rf $(BUILD_DIR)

docker: build
if [ "${SGX_MODE}" = "HW" ]; then \
export HW_EXTENSION="-hw" ; \
fi && \
make -C ${FPC_PATH}/ecc DOCKER_IMAGE=${DOCKER_IMAGE_NAME}$${HW_EXTENSION} DOCKER_ENCLAVE_SO_PATH=${FPC_PATH}/samples/demos/irb/chaincode/${BUILD_DIR}/lib all docker

PROTO_BUILD_DIR := _protos
PROTO_PATH := ../protos
PROTO_FILES := irb.proto

.PHONY: protos
protos: $(PROTO_BUILD_DIR)
$(PROTOC_CMD) \
--plugin=protoc-gen-nanopb=$(NANOPB_PATH)/generator/protoc-gen-nanopb-py2 \
--proto_path=$(PROTO_PATH) "--nanopb_out=-f ${PROTO_PATH}/irb.options:$(PROTO_BUILD_DIR)" $(PROTO_FILES)

$(PROTO_BUILD_DIR):
mkdir -p $@

.PHONY: protos-clean
protos-clean:
rm -rf $(PROTO_BUILD_DIR)
Loading

0 comments on commit 0aea62d

Please sign in to comment.