-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathc7.casm
39 lines (29 loc) · 1.09 KB
/
c7.casm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# AES-GCM-encrypt one block of plaintext and check for any carriage returns
# the plaintext has.
6 901
2 160 308
# notary inputs
# 128: client_write_key share
# 32 : client_write_IV share
# client inputs
# 128: client_write_key share
# 32 : client_write_IV share
# 128: plaintext block
# 10 : nonce
# 10 : counter (max block counter that can fit into 10 bits is 1023)
1 144
# all outputs go to the evaluator
# 128: encrypted plaintext block
# 16 : for each byte of the plaintext block, a bit will be set to 1 if the byte
# is a carriage return
2 1 0 0 468 XOR # 0
# unmask client_write_key
256 128 [0|>128] [160|>128] [469|>128] xor128bits.casm
# unmask client_write_IV
64 32 [128|>32] [288|>32] [597|>32] xor32bits.casm
# encrypt client_write_IV + nonce (8 bytes) + counter (4 bytes)
256 128 [469|>128] [458|>10] [468*22] [448|>10] [468*54] [597|>32] [629|>128] aes-128-reverse.txt
# xor encrypted counter with plaintext to get ciphertext
256 128 [629|>128] [320|>128] [757|>128] xor128bits.casm
# check for carriage returns in the plaintext
128 16 [320|>128] [885|>16] checkCarriageReturn.casm