16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
return $data
}
#
# Create test case and output to test file
#
proc do_test {group cipher test_num tc params fn} {
array set config [list repeat 1]
array set config $params
# Test info
set line [format "tcltest::test %s-%d.%d {%s %s} \\\n\t" $group $test_num $tc [string totitle $fn] $cipher]
# Test constraints
append line [format "-constraints %s \\\n\t" [string map [list "-" "_"] $cipher]]
|
|
|
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
return $data
}
#
# Create test case and output to test file
#
proc do_test {group cipher test_num tc params fn} {
array set config [list iterations 1 repeat 1]
array set config $params
# Test info
set line [format "tcltest::test %s-%d.%d {%s %s} \\\n\t" $group $test_num $tc [string totitle $fn] $cipher]
# Test constraints
append line [format "-constraints %s \\\n\t" [string map [list "-" "_"] $cipher]]
|
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
# Add test parameters
foreach {param names type} [list -key [list key] s -iv [list iv nonce] s -data $list1 s] {
foreach name $names {
if {[info exists config($name)]} {
set data [get_value $type $config($name)]
if {$data ne ""} {
append cmd " " $param " " $data " \\\n\t\t"
}
break
}
}
}
append line [format {-body {binary encode hex [%s]}} [string trimright $cmd " \\\n\t"]]
append line " \\\n\t"
|
>
|
>
>
>
|
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
# Add test parameters
foreach {param names type} [list -key [list key] s -iv [list iv nonce] s -data $list1 s] {
foreach name $names {
if {[info exists config($name)]} {
set data [get_value $type $config($name)]
if {$data ne ""} {
if {$param ne "-data" || $config(iterations) == 1} {
append cmd " " $param " " $data " \\\n\t\t"
} else {
set cmd [string cat "set data " $data ";for \{set i 0\} \{\$i < " $config(iterations) "\} \{incr i\} \{set data \[" $cmd " " $param " \$data\]\};set data"]
}
}
break
}
}
}
append line [format {-body {binary encode hex [%s]}} [string trimright $cmd " \\\n\t"]]
append line " \\\n\t"
|
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
|
foreach filename [glob -directory $path *.txt] {
puts [format "Processing %s" $filename]
set tail [file tail $filename]
if {[string match -nocase "Readme.txt" $tail]} {
continue
}
set cipher [file rootname [file tail $filename]]
set id [format "%s_%s" $group $cipher]
set test_num [incr test_ids($id)]
parse $id $filename $test_num $cipher
}
}
main [pwd]
exit
|
|
|
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
|
foreach filename [glob -directory $path *.txt] {
puts [format "Processing %s" $filename]
set tail [file tail $filename]
if {[string match -nocase "Readme.txt" $tail]} {
continue
}
set cipher [string trim [file rootname [file tail $filename]]]
set id [format "%s_%s" $group $cipher]
set test_num [incr test_ids($id)]
parse $id $filename $test_num $cipher
}
}
main [pwd]
exit
|