Diff

Differences From Artifact [3d7c03c49d]:

To Artifact [706606e435]:


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
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







-
+






-
+










-
+







    } -result {missing {} unexpected {}}

test Ciphers_Protocol_Specific-4.5 {TLS1.2} -constraints {tls1.2} -body {
	lcompare [exec_get ":" ciphers -tls1_2 -s] [::tls::ciphers tls1.2 0 1]
    } -result {missing {} unexpected {}}

test Ciphers_Protocol_Specific-4.6 {TLS1.3} -constraints {tls1.3} -body {
	lcompare [concat [exec_get ":" ciphers -tls1_3 -s] [exec_get ":" ciphers -tls1_2 -s]] [::tls::ciphers tls1.3 0 1]
	lcompare [exec_get ":" ciphers -tls1_3 -s] [::tls::ciphers tls1.3 0 1]
    } -result {missing {} unexpected {}}
# Ciphers Error Cases


test Ciphers_Errors-5.1 {Too many args} -body {
	::tls::ciphers too many args to pass
    } -result {wrong # args: should be "tls::ciphers ?protocol? ?verbose? ?supported?"} -returnCodes {1}
    } -result {wrong # args: should be "::tls::ciphers ?protocol? ?verbose? ?supported?"} -returnCodes {1}

test Ciphers_Errors-5.2 {Invalid protocol} -body {
	::tls::ciphers bogus
    } -result {bad protocol "bogus": must be ssl2, ssl3, tls1, tls1.1, tls1.2, or tls1.3} -returnCodes {1}

test Ciphers_Errors-5.3 {Invalid verbose} -body {
	::tls::ciphers tls1.3 bogus
    } -result {expected boolean value but got "bogus"} -returnCodes {1}

test Ciphers_Errors-5.4 {Invalid supported} -body {
	::tls::ciphers tls1_3 1 bogus
	::tls::ciphers tls1.3 1 bogus
    } -result {expected boolean value but got "bogus"} -returnCodes {1}

test Ciphers_Errors-5.5 {SSL2} -constraints {!ssl2} -body {
	::tls::ciphers ssl2
    } -result {ssl2: protocol not supported} -returnCodes {1}

test Ciphers_Errors-5.6 {SSL3} -constraints {!ssl3} -body {
307
308
309
310
311
312
313
314

315
316
317
318

319
320
321
322

323
324
325
326

327
328
329
330
331
332
333
307
308
309
310
311
312
313

314
315
316
317

318
319
320
321

322
323
324
325

326
327
328
329
330
331
332
333







-
+



-
+



-
+



-
+







	string toupper [binary encode hex [tls::digest md5 -bin -key "Example key" -data "Example string for message digest tests."]]
    } -result {901DA6E6976A71650C77443C37FF9C7F}
# Digest Error Cases


test Digest_Errors-13.1 {Too few args} -body {
	::tls::digest
    } -result {wrong # args: should be "::tls::digest type ?-bin|-hex? ?-key hmac_key? [-channel chan | -file filename | ?-data? data]"} -returnCodes {1}
    } -result {wrong # args: should be "::tls::digest digest ?-bin|-hex? ?-cipher name? ?-key hmac_key? [-channel chan | -command cmdName | -file filename | ?-data? data]"} -returnCodes {1}

test Digest_Errors-13.2 {Too many args} -body {
	::tls::digest too many args to pass the test without an error
    } -result {wrong # args: should be "::tls::digest type ?-bin|-hex? ?-key hmac_key? [-channel chan | -file filename | ?-data? data]"} -returnCodes {1}
    } -result {wrong # args: should be "::tls::digest digest ?-bin|-hex? ?-cipher name? ?-key hmac_key? [-channel chan | -command cmdName | -file filename | ?-data? data]"} -returnCodes {1}

test Digest_Errors-13.3 {Invalid digest} -body {
	::tls::digest bogus data
    } -result {Invalid digest type "bogus"} -returnCodes {1}
    } -result {Invalid digest "bogus"} -returnCodes {1}

test Digest_Errors-13.4 {Invalid option} -body {
	::tls::digest sha256 -bogus value
    } -result {bad option "-bogus": must be -bin, -data, -file, -filename, -hex, or -key} -returnCodes {1}
    } -result {bad option "-bogus": must be -bin, -channel, -cipher, -command, -data, -file, -filename, -hex, or -key} -returnCodes {1}

test Digest_Errors-13.5 {Invalid file} -body {
	::tls::digest sha256 -file bogus
    } -result {couldn't open "bogus": no such file or directory} -returnCodes {1}

test Digest_Errors-13.6 {Invalid channel} -body {
	::tls::digest sha256 -channel bogus