Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
ushitora-anqou committed Dec 16, 2019
1 parent 08d11a0 commit 5f69eb6
Showing 1 changed file with 28 additions and 11 deletions.
39 changes: 28 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
# KVSP; Kyoto Virtual Secure Platform

KVSP is a small interface to use a virtual secure platform simply,
KVSP is the first virtual secure platform in the world,
which makes your life better.

Caveat: this project is under construction.
On VSP you can run your encrypted code as is.
No need to decrypt while running. See [here](https://anqou.net/poc/2019/10/18/post-3106/)
for more details (in Japanese).

KVSP consists of many other sub-projects.
`kvsp` command, which this repository serves, is
a simple interface to use them easily.

## Tutorial

Expand Down Expand Up @@ -41,11 +47,20 @@ int main()
$ ./kvsp cc fib.c -o fib
## Let's check if the program is correct by emulator, which runs
## it without encryption.
$ ./kvsp emu -q fib
x0=5 x1=510 x2=0 x3=0 x4=0 x5=0 x6=0 x7=0 x8=5 x9=3 x10=0 x11=0 x12=0 x13=0 x14=0 x15=0 pc=5
## without encryption.
$ ./kvsp emu fib
LogicFile:/path/to/kvsp/build/share/kvsp/vsp-core.json
ResultFile:/tmp/389221298
Exec count:346
---Debug Output---
...
Reg 8 : 5
## We can see `x8=5` here, so it seems to work correctly.
...
## We can see `Reg 8 : 5` here and fib(5) is indeed 5, so it seems to work correctly.
## Now we will run the same program with encryption.
## Generate a secret key (`secret.key`).
Expand All @@ -54,15 +69,17 @@ $ ./kvsp genkey -o secret.key
## Encrypt `fib` with `secret.key` to get an encrypted executable file (`fib.enc`).
$ ./kvsp enc -k secret.key -i fib -o fib.enc
## Run `fib.enc` for 400 clocks to get an encrypted result (`result.enc`).
## Run `fib.enc` for 346 clocks to get an encrypted result (`result.enc`).
## (The number of clocks here is decided depending on the `Exec count` of
## the result of `kvsp emu fib` above.)
## Notice that we DON'T need the secret key (`secret.key`) here,
## which means the encrypted program (`fib.enc`) runs without decryption!
$ ./kvsp run -i fib.enc -o result.enc -c 400
ExecCycle:400
$ ./kvsp run -i fib.enc -o result.enc -c 346
LogicFile:/path/to/kvsp/share/kvsp/vsp-core.json
ResultFile:result.enc
ExecCycle:346
ThreadNum:13
LogicFile:/path/to/kvsp/build/share/kvsp/vsp-core.json
CipherFile:fib.enc
ResultFile:result.enc
...
Expand Down

0 comments on commit 5f69eb6

Please sign in to comment.