Skip to content

Commit

Permalink
Move SGX enclave signing key to gist (#1393)
Browse files Browse the repository at this point in the history
  • Loading branch information
nhynes authored and tqchen committed Jul 6, 2018
1 parent cca57ae commit 7dca7e4
Show file tree
Hide file tree
Showing 12 changed files with 9 additions and 568 deletions.
6 changes: 5 additions & 1 deletion apps/sgx/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,12 @@ lib/tvm_t.o: lib/tvm_t.c
lib/test_addone.so: $(TVM_ROOT)/src/runtime/sgx/trusted/runtime.cc lib/tvm_t.o lib/test_addone_sys.o
$(CXX) $^ -o $@ $(pkg_cflags) $(pkg_ldflags) $(enclave_cxxflags) $(enclave_ldflags) -g

# The demo enclave signing key
lib/enclave.pem:
curl -Lso $@ https://gist.githubusercontent.com/nhynes/8a2d80068a92e672f8b0b7d710ceb404/raw/2d5ae5fbe83198ede49465fdc6535065e093543b/tvm_sgx_demo.pem

# The signed enclave
lib/test_addone.signed.so: lib/test_addone.so enclave_config.xml
lib/test_addone.signed.so: lib/test_addone.so enclave_config.xml lib/enclave.pem
$(sgx_enclave_signer) sign -key lib/enclave.pem -enclave $< -out $@ -config enclave_config.xml

clean:
Expand Down
57 changes: 4 additions & 53 deletions apps/sgx/prepare_test_libs.py
Original file line number Diff line number Diff line change
@@ -1,53 +1,15 @@
"""Script to prepare test_addone_sys.o"""

from __future__ import print_function
from os import path as osp

import tvm

CWD = osp.dirname(osp.abspath(osp.expanduser(__file__)))

KEY_HEAD_FOOT = '-----{} RSA PRIVATE KEY-----'
KEY = """ MIIG4gIBAAKCAYEAroOogvsj/fZDZY8XFdkl6dJmky0lRvnWMmpeH41Bla6U1qLZ
AmZuyIF+mQC/cgojIsrBMzBxb1kKqzATF4+XwPwgKz7fmiddmHyYz2WDJfAjIveJ
ZjdMjM4+EytGlkkJ52T8V8ds0/L2qKexJ+NBLxkeQLfV8n1mIk7zX7jguwbCG1Pr
nEMdJ3Sew20vnje+RsngAzdPChoJpVsWi/K7cettX/tb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Lh5s5Zr3gBRwbWNZyzhXk=
""".strip()

def prepare_test_libs(base_path):
def main():
out_dir = osp.join(CWD, 'lib')

n = tvm.var('n')
A = tvm.placeholder((n,), name='A')
B = tvm.compute(A.shape, lambda *i: A(*i) + 1, name='B')
Expand All @@ -57,18 +19,7 @@ def prepare_test_libs(base_path):

# Compile library in system library mode
fadd_syslib = tvm.build(s, [A, B], 'llvm --system-lib')
syslib_path = osp.join(base_path, 'test_addone_sys.o')
fadd_syslib.save(syslib_path)

def main():
out_dir = osp.join(CWD, 'lib')

prepare_test_libs(out_dir)

with open(osp.join(out_dir, 'enclave.pem'), 'w') as f_key:
print(KEY_HEAD_FOOT.format('BEGIN'), file=f_key)
print(KEY, file=f_key)
print(KEY_HEAD_FOOT.format('END'), file=f_key)
fadd_syslib.save(osp.join(out_dir, 'test_addone_sys.o'))


if __name__ == '__main__':
Expand Down
2 changes: 0 additions & 2 deletions nnvm/examples/sgx/.gitignore

This file was deleted.

102 changes: 0 additions & 102 deletions nnvm/examples/sgx/Makefile

This file was deleted.

39 changes: 0 additions & 39 deletions nnvm/examples/sgx/README.md

This file was deleted.

135 changes: 0 additions & 135 deletions nnvm/examples/sgx/app.cc

This file was deleted.

Loading

0 comments on commit 7dca7e4

Please sign in to comment.