Giter Site home page Giter Site logo

penglai-sdk's Introduction

Penglai SDK

This is the SDK for Penglai TEE (sPMP and PMP version).

If you are seeking for SDK for Penglai-TVM, please refer Penglai-SDK-TVM

This repo contains SDK to write host-side applications and enclave-apps, as well as some demos.

Quick Start

Penglai (PMP) provides the instructions and scripts to build and run SDK demos.

Demos

The demo/ directory provides several example enclave applications, e.g., prime.

Building your own demo

As explained in Penglai (PMP), running an enclave demo requires two executables, host and enclave.

If you just want to write some simple demos, such as hello_world, then you can directly use the host executable we provide.

First you should create a new directory in the demo directory to place your enclave related files, such as hello_world, and then create a new file for writing your code, such as hello_world.c.

Before you write your own enclave code, you can refer to the writing of demo/prime/prime.c, and you should note the following requirements:

  • EAPP_ENTRY is used to declare that this is the entry function of an enclave;
  • EAPP_RESERVE_REG is is used to save the value of the register;
  • EAPP_RETURN is used to provide the return value after exiting the enclave;
  • If you need to output some information, you can use the eapp_print function which is also used in prime.c, and you can also see its implementation in lib/app/src/print.c;
  • Make sure you include the appropriate header files: #include "eapp.h" and #include "print.h";

After you have written the logic of your enclave, you also need to write a corresponding Makefile for your enclave. If your enclave is simple, you can directly imitate the structure of demo/prime/Makefile.

Finally, you need to modify the demo/Makefile to add the name of the newly created directory to the corresponding location. For example, you need to add make -C hello_world under the all target and make -C hello_world clean under the clean target.

Now, you can re-execute PENGLAI_SDK=$(pwd) make -j8 command. If everything is successful, you will see the corresponding executable file appear in your demo directory. Then you just need to refer to Penglai (PMP) to copy the executable file to the VM using scp, and run your own demo, e.g., a hello_world enclave, using ./host hello_world.

Congratulations! You have successfully built and run a demo written by yourself on Penglai.

Quickly build your own demo with secGear

SecGear is a confidential computing security application development kit for the computing industry, which aims to provide a unified development framework for developers on different hardware devices. Currently, RISCV-V penglai TEE is supported.

You can refer to the following documentation to get started with secGear for Penglai enclave.

secGear for RISC-V TEE

Licenses

Mulan Permissive Software License,Version 1 (Mulan PSL v1)

Code Contributions

Please use Merge Request/Pull Requests on to pose and contribute your work.

Please fell free to post your concerns, ideas, code or anything others to issues.

Wiki and more documents

Refer our doc website.

penglai-sdk's People

Contributors

ddnirvana avatar moonquakes avatar shang-qy avatar fly0307 avatar penglai-enclave avatar fengerhu1 avatar arti5t avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.