Newer
Older
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
#!/usr/bin/python3
import re
import os
import sys
debug = True
lines = sys.stdin.readlines()
lemma = sys.argv[1]
# INPUT:
# - lines contain a list of "%i:goal" where "%i" is the index of the goal
# - lemma contain the name of the lemma under scrutiny
# OUTPUT:
# - (on stdout) a list of ordered index separated by EOL
vk=dict()
rank = [] # list of list of goals, main list is ordered by priority
maxPrio = 110
for i in range(0,maxPrio):
rank.append([])
if re.match('.*Unforgeability.*$', lemma):
print("applying oracle to Unforgeability")
for line in lines:
num = line.split(':')[0]
if re.match('.*\!Pk\(.*', line): rank[109].append(num)
elif re.match('.*\!TPM_.*', line): rank[109].append(num)
elif re.match('.*CP_State.*', line): rank[109].append(num)
elif re.match('.*\!Out.*', line): rank[109].append(num)
elif re.match('.*\!KU\( ~sid \)', line): rank[10].append(num)
elif re.match('.*\!KU\( ~.* \)', line): rank[107].append(num)
elif re.match('.*\!KU\(.*multp\(H_n_2\(.*', line): rank[99].append(num)
elif re.match('.*\!KU\(.*multp\(~l, multp\(~y,.*', line): rank[98].append(num)
elif re.match('.*\!KU\( H_n_2\(.*', line): rank[97].append(num)
elif re.match('.*\!KU\( H_k_2\(.*', line): rank[97].append(num)
elif re.match('.*\!KU\( H_k_7\(.*', line): rank[97].append(num)
elif re.match('.*\!KU\( E_S\(.*', line): rank[97].append(num)
elif re.match('.*In_S\( .*\'returnEK\'>', line): rank[92].append(num)
elif re.match('.*In_S\( .*\'ret_TPM2_Certify\'>', line): rank[92].append(num)
elif re.match('.*In_S\( .*\'createDAAKey\'>', line): rank[91].append(num)
elif re.match('.*In_S\( \$PS.*', line): rank[87].append(num)
elif re.match('.*In_S\( \$AS.*', line): rank[87].append(num)
elif re.match('.*In_S_B\( \$AS, .*', line): rank[87].append(num)
elif re.match('.*splitEqs.*', line): rank[5].append(num)
elif re.match('.*', line): rank[20].append(num)
elif re.match('.*_CP_sessKey$', lemma) or re.match('.*test1', lemma):
print("applying oracle to Unforgeability")
for line in lines:
num = line.split(':')[0]
if re.match('.*\!Pk\(.*', line): rank[109].append(num)
elif re.match('.*\!TPM_.*', line): rank[109].append(num)
elif re.match('.*CP_State.*', line): rank[109].append(num)
elif re.match('.*\!Out.*', line): rank[109].append(num)
elif re.match('.*\!KU\( ~g \)', line): rank[11].append(num)
elif re.match('.*\!KU\( ~sid \)', line): rank[10].append(num)
elif re.match('.*In_S\( .*\'returnDAAKey\'>', line): rank[101].append(num)
elif re.match('.*\!KU\( ~f \)', line): rank[100].append(num)
elif re.match('.*\!KU\( ~.* \)', line): rank[107].append(num)
elif re.match('.*\!KU\( sign\(h\(.*', line): rank[99].append(num)
elif re.match('.*In_S\( .*\'ret_TPM2_Sign_S\'>', line): rank[98].append(num)
elif re.match('.*In_S\( .*\'ret_TPM2_Certify\'>', line): rank[97].append(num)
elif re.match('.*In_S\( .*\'createdSessionKey\'>', line): rank[96].append(num)
elif re.match('.*\!KU\(.*multp\(H_n_2\(.*', line): rank[95].append(num)
elif re.match('.*\!KU\( H_n_2\(.*', line): rank[94].append(num)
elif re.match('.*\!KU\(.*multp\(~l, multp\(~y,.*', line): rank[93].append(num)
elif re.match('.*\!KU\( H_k_2\(.*', line): rank[92].append(num)
elif re.match('.*\!KU\( H_k_7\(.*', line): rank[92].append(num)
elif re.match('.*\!KU\( E_S\(.*', line): rank[92].append(num)
elif re.match('.*\!KU\(.*plus\(multp\(~.*', line): rank[90].append(num)
elif re.match('.*\!KU\(.*multp\(sl.*', line): rank[87].append(num)
elif re.match('.*\!KU\(*multp\(~.*', line): rank[89].append(num)
elif re.match('.*\!KU\(.*multp\(.*', line): rank[88].append(num)
elif re.match('.*In_S\( \$PS.*', line): rank[80].append(num)
elif re.match('.*In_S\( \$AS.*', line): rank[80].append(num)
elif re.match('.*In_S_B\( \$AS, .*', line): rank[80].append(num)
elif re.match('.*splitEqs.*', line): rank[5].append(num)
elif re.match('.*', line): rank[20].append(num)
elif re.match('.*test2', lemma) or re.match('.*_CP_data$', lemma):
print("applying oracle to Unforgeability")
for line in lines:
num = line.split(':')[0]
if re.match('.*\!Pk\(.*', line): rank[109].append(num)
elif re.match('.*\!TPM_.*', line): rank[109].append(num)
elif re.match('.*CP_State.*', line): rank[109].append(num)
elif re.match('.*\!Out.*', line): rank[109].append(num)
elif re.match('.*\!KU\( ~sid', line): rank[10].append(num)
elif re.match('.*< #i.*', line): rank[108].append(num)
elif re.match('.*In_S\( .*\'returnDAAKey\'>', line): rank[101].append(num)
elif re.match('.*In_S\( .*\'createdSessionKey\'>', line): rank[101].append(num)
elif re.match('.*\!KU\( ~g', line): rank[100].append(num)
elif re.match('.*\!KU\( ~f', line): rank[100].append(num)
elif re.match('.*\!KU\( ~.* \)', line): rank[107].append(num)
elif re.match('.*\!KU\( sign\(h\(.*', line): rank[99].append(num)
elif re.match('.*In_S\( .*\'ret_TPM2_HMAC\'>', line): rank[98].append(num)
elif re.match('.*In_S\( .*\'ret_TPM2_Sign_S\'>', line): rank[98].append(num)
elif re.match('.*In_S\( .*\'ret_TPM2_Certify\'>', line): rank[97].append(num)
elif re.match('.*In_S\( .*\'createdSessionKey\'>', line): rank[96].append(num)
elif re.match('.*\!KU\(.*multp\(H_n_2\(.*', line): rank[95].append(num)
elif re.match('.*\!KU\( H_n_2\(.*', line): rank[94].append(num)
elif re.match('.*\!KU\(.*multp\(~l, multp\(~y,.*', line): rank[93].append(num)
elif re.match('.*\!KU\( H_k_2\(.*', line): rank[92].append(num)
elif re.match('.*\!KU\( H_k_7\(.*', line): rank[92].append(num)
elif re.match('.*\!KU\( E_S\(.*', line): rank[92].append(num)
elif re.match('.*\!KU\(.*plus\(multp\(~.*', line): rank[90].append(num)
elif re.match('.*\!KU\(.*multp\(sl.*', line): rank[87].append(num)
elif re.match('.*\!KU\(*multp\(~.*', line): rank[89].append(num)
elif re.match('.*\!KU\(.*multp\(.*', line): rank[88].append(num)
elif re.match('.*In_S\( \$PS.*', line): rank[80].append(num)
elif re.match('.*In_S\( \$AS.*', line): rank[80].append(num)
elif re.match('.*In_S_B\( \$AS, .*', line): rank[80].append(num)
elif re.match('.*In_A\(.*', line): rank[75].append(num)
elif re.match('.*splitEqs.*', line): rank[5].append(num)
elif re.match('.*', line): rank[20].append(num)
else:
print("not applying the rule")
exit(0)
# Ordering all goals by ranking (higher first)
for listGoals in reversed(rank):
for goal in listGoals:
sys.stderr.write(goal)
print(goal)