-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #511.
- Loading branch information
Showing
2 changed files
with
27 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,38 @@ | ||
m <- cryptol_load "DES.cry"; | ||
let enc = {{ m::DES.encrypt }}; | ||
let dec = {{ m::DES.decrypt }}; | ||
import "DES.cry"; | ||
|
||
print "proving dec_enc..."; | ||
let {{ prop1 key msg = dec key (enc key msg) == msg }}; | ||
dec_enc <- prove_print do { unfolding ["enc", "dec"]; abc; } {{prop1}}; | ||
let prop1 = {{ \key msg -> decrypt key (encrypt key msg) == msg }}; | ||
dec_enc <- prove_print abc {{prop1}}; | ||
|
||
print dec_enc; | ||
|
||
print "proving enc_dec..."; | ||
let {{ prop2 key msg = enc key (dec key msg) == msg }}; | ||
enc_dec <- prove_print do { unfolding ["enc", "dec"]; abc; } {{prop2}}; | ||
let prop2 = {{ \key msg -> encrypt key (decrypt key msg) == msg }}; | ||
enc_dec <- prove_print abc {{prop2}}; | ||
|
||
print enc_dec; | ||
|
||
let ss = addsimp dec_enc (addsimp enc_dec empty_ss); | ||
let ss = addsimp dec_enc (addsimp enc_dec basic_ss); | ||
|
||
let {{ enc3 k1 k2 k3 msg = enc k3 (dec k2 (enc k1 msg)) }}; | ||
let {{ dec3 k1 k2 k3 msg = dec k1 (enc k2 (dec k3 msg)) }}; | ||
let {{ enc3 k1 k2 k3 msg = encrypt k3 (decrypt k2 (encrypt k1 msg)) }}; | ||
let {{ dec3 k1 k2 k3 msg = decrypt k1 (encrypt k2 (decrypt k3 msg)) }}; | ||
|
||
print "proving dec3_enc3..."; | ||
let {{ prop3 k1 k2 k3 msg = dec3 k1 k2 k3 (enc3 k1 k2 k3 msg) == msg }}; | ||
prove_print do { simplify ss; print_goal; abc; } {{prop3}}; | ||
prove_print do { | ||
unfolding ["prop3"]; | ||
unfolding ["dec3", "enc3"]; | ||
simplify ss; | ||
print_goal; | ||
abc; | ||
} {{prop3}}; | ||
|
||
print "proving enc3_dec3..."; | ||
let {{ prop4 k1 k2 k3 msg = enc3 k1 k2 k3 (dec3 k1 k2 k3 msg) == msg }}; | ||
prove_print do { simplify ss; print_goal; abc; } {{prop4}}; | ||
prove_print do { | ||
unfolding ["prop4"]; | ||
unfolding ["dec3", "enc3"]; | ||
simplify ss; | ||
print_goal; | ||
abc; | ||
} {{prop4}}; |