19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
-
|
foreach protocol [::tls::protocols] {::tcltest::testConstraint $protocol 1}
::tcltest::testConstraint OpenSSL [string match "OpenSSL*" [::tls::version]]
# Helper functions
proc lcompare {list1 list2} {set m "";set u "";foreach i $list1 {if {$i ni $list2} {lappend m $i}};foreach i $list2 {if {$i ni $list1} {lappend u $i}};return [list "missing" $m "unexpected" $u]}
proc exec_get {delim args} {return [split [exec openssl {*}$args] $delim]}
proc exec_get_ciphers {} {set list [list];set data [exec openssl ciphers ALL];foreach cipher [split $data ":"] {lappend list [string tolower $cipher]};return [lsort $list]}
proc exec_get_digests {} {set list [list];set data [exec openssl dgst -list];foreach line [split $data "\n"] {foreach digest $line {if {[string match "-*" $digest]} {lappend list [string trimleft $digest "-"]}}};return [lsort $list]}
proc no_rsa {digests} {set list [list];foreach digest $digests {if {![string match -nocase "*RSA*" $digest]} {lappend list $digest}};return [lsort $list]}
# Test list ciphers
test CiphersAll-1.1 {} -body {
lcompare [lsort [exec_get_ciphers]] [lsort [::tls::ciphers]]
} -result {missing {} unexpected {}}
# Test list ciphers for protocols
|
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
|
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
|
-
+
|
test Version-5.2 {OpenSSL} -constraints {OpenSSL} -body {
::tls::version
} -match {glob} -result {OpenSSL*}
# Test list digests
test Digest_List-6.1 {Digest List} -body {
lcompare [exec_get_digests] [no-rsa [tls::digests]]
lcompare [lsort [exec_get_digests]] [lsort [tls::digests]]
} -result {missing {} unexpected {}}
# Test Digests
test Digest-7.1 {md4 opt} -body {
tls::md4 "Example string for message digest tests."
} -result {181CDCF9DB9B6FA8FC0A3BF9C34E29D9}
|