11# KVSP; Kyoto Virtual Secure Platform
22
3- KVSP is a small interface to use a virtual secure platform simply ,
3+ KVSP is the first virtual secure platform in the world ,
44which makes your life better.
55
6- Caveat: this project is under construction.
6+ On VSP you can run your encrypted code as is.
7+ No need to decrypt while running. See [ here] ( https://anqou.net/poc/2019/10/18/post-3106/ )
8+ for more details (in Japanese).
9+
10+ KVSP consists of many other sub-projects.
11+ ` kvsp ` command, which this repository serves, is
12+ a simple interface to use them easily.
713
814## Tutorial
915
@@ -41,11 +47,20 @@ int main()
4147$ ./kvsp cc fib.c -o fib
4248
4349## Let's check if the program is correct by emulator, which runs
44- ## it without encryption.
45- $ ./kvsp emu -q fib
46- 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
50+ ## without encryption.
51+ $ ./kvsp emu fib
52+ LogicFile:/path/to/kvsp/build/share/kvsp/vsp-core.json
53+ ResultFile:/tmp/389221298
54+ Exec count:346
55+ ---Debug Output---
56+
57+ ...
58+
59+ Reg 8 : 5
4760
48- ## We can see `x8=5` here, so it seems to work correctly.
61+ ...
62+
63+ ## We can see `Reg 8 : 5` here and fib(5) is indeed 5, so it seems to work correctly.
4964## Now we will run the same program with encryption.
5065
5166## Generate a secret key (`secret.key`).
@@ -54,15 +69,17 @@ $ ./kvsp genkey -o secret.key
5469## Encrypt `fib` with `secret.key` to get an encrypted executable file (`fib.enc`).
5570$ ./kvsp enc -k secret.key -i fib -o fib.enc
5671
57- ## Run `fib.enc` for 400 clocks to get an encrypted result (`result.enc`).
72+ ## Run `fib.enc` for 346 clocks to get an encrypted result (`result.enc`).
73+ ## (The number of clocks here is decided depending on the `Exec count` of
74+ ## the result of `kvsp emu fib` above.)
5875## Notice that we DON'T need the secret key (`secret.key`) here,
5976## which means the encrypted program (`fib.enc`) runs without decryption!
60- $ ./kvsp run -i fib.enc -o result.enc -c 400
61- ExecCycle:400
77+ $ ./kvsp run -i fib.enc -o result.enc -c 346
78+ LogicFile:/path/to/kvsp/share/kvsp/vsp-core.json
79+ ResultFile:result.enc
80+ ExecCycle:346
6281ThreadNum:13
63- LogicFile:/path/to/kvsp/build/share/kvsp/vsp-core.json
6482CipherFile:fib.enc
65- ResultFile:result.enc
6683
6784...
6885
0 commit comments