235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
|
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
|
-
+
-
+
-
+
-
+
|
test MD_Errors-8.2 {Too many args} -body {
::tls::md too many command line args to pass the test without an error or failing
} -result {wrong # args: should be "::tls::md ?-bin|-hex? ?-cipher name? ?-digest name? ?-key key? ?-mac name? [-channel chan | -command cmdName | -file filename | ?-data? data]"} -returnCodes {1}
test MD_Errors-8.3 {Invalid digest} -body {
::tls::md bogus data
} -result {Invalid digest "bogus"} -returnCodes {1}
} -result {invalid digest "bogus"} -returnCodes {1}
test MD_Errors-8.4 {Invalid digest Arg} -body {
::tls::md -digest bogus -data data
} -result {Invalid digest "bogus"} -returnCodes {1}
} -result {invalid digest "bogus"} -returnCodes {1}
test MD_Errors-8.5 {No digest} -body {
::tls::md -hex -data value
} -result {No digest specified} -returnCodes {1}
} -result {no digest} -returnCodes {1}
test MD_Errors-8.6 {Invalid option} -body {
::tls::md -digest sha256 -bogus value
} -result {bad option "-bogus": must be -bin, -binary, -hex, -hexadecimal, -chan, -channel, -cipher, -command, -data, -digest, -file, -filename, -hash, -key, or -mac} -returnCodes {1}
test MD_Errors-8.7 {Invalid file} -body {
::tls::md -digest sha256 -file bogus
} -result {couldn't open "bogus": no such file or directory} -returnCodes {1}
test MD_Errors-8.8 {Invalid channel} -body {
::tls::md -digest sha256 -channel bogus
} -result {can not find channel named "bogus"} -returnCodes {1}
test MD_Errors-8.9 {No operation} -body {
::tls::md -digest sha256 -bin
} -result {No operation specified: Use -channel, -command, -data, or -file option} -returnCodes {1}
} -result {No operation: Use -channel, -command, -data, or -file option} -returnCodes {1}
# Test CMAC command
set test_cipher "aes-128-cbc"
set test_key "Example key 1234"
|
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
|
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
|
-
+
-
+
-
+
|
test CMAC_Errors-12.2 {Too many args} -body {
::tls::cmac too many command line args to pass the test without an error or failing
} -result {wrong # args: should be "::tls::cmac ?-bin|-hex? ?-cipher name? ?-digest name? ?-key key? ?-mac name? [-channel chan | -command cmdName | -file filename | ?-data? data]"} -returnCodes {1}
test CMAC_Errors-12.3 {No cipher} -body {
::tls::cmac -hex -data $test_data
} -result {No cipher specified} -returnCodes {1}
} -result {no cipher} -returnCodes {1}
test CMAC_Errors-12.4 {No key} -body {
::tls::cmac -cipher $test_cipher -data $test_data
} -result {No key specified} -returnCodes {1}
} -result {no key} -returnCodes {1}
test CMAC_Errors-12.5 {Invalid cipher} -body {
::tls::cmac -cipher bogus -data $test_data
} -result {Invalid cipher "bogus"} -returnCodes {1}
} -result {invalid cipher "bogus"} -returnCodes {1}
# Test HMAC command
set test_digest md5
set test_key "Example key"
|
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
|
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
|
-
+
-
+
-
+
|
test HMAC_Errors-16.2 {Too many args} -body {
::tls::hmac too many command line args to pass the test without an error or failing
} -result {wrong # args: should be "::tls::hmac ?-bin|-hex? ?-cipher name? ?-digest name? ?-key key? ?-mac name? [-channel chan | -command cmdName | -file filename | ?-data? data]"} -returnCodes {1}
test HMAC_Errors-16.3 {No digest} -body {
::tls::hmac -hex -data $test_data
} -result {No digest specified} -returnCodes {1}
} -result {no digest} -returnCodes {1}
test HMAC_Errors-16.4 {No key} -body {
::tls::hmac -digest sha256 -data $test_data
} -result {No key specified} -returnCodes {1}
} -result {no key} -returnCodes {1}
test HMAC_Errors-16.5 {Invalid digest} -body {
::tls::md -digest bogus -key $test_key -data $test_data
} -result {Invalid digest "bogus"} -returnCodes {1}
} -result {invalid digest "bogus"} -returnCodes {1}
# Test MAC command
set test_cipher "aes-128-cbc"
set test_digest sha256
set test_key "Example key 1234"
|
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
|
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
|
-
+
-
-
+
+
-
-
+
+
|
test MAC_Errors-18.1 {Too few args} -body {
::tls::mac
} -result {wrong # args: should be "::tls::mac ?-bin|-hex? ?-cipher name? ?-digest name? ?-key key? ?-mac name? [-channel chan | -command cmdName | -file filename | ?-data? data]"} -returnCodes {1}
test MAC_Errors-18.2 {No mac} -body {
::tls::mac -key $test_key -data $test_data
} -result {No MAC specified} -returnCodes {1}
} -result {no MAC} -returnCodes {1}
test MAC_Errors-18.3 {No key} -body {
::tls::mac -mac hmac -data $test_data
} -result {No key specified} -returnCodes {1}
::tls::mac -mac hmac -digest $test_digest -data $test_data
} -result {no key} -returnCodes {1}
test MAC_Errors-18.4 {Invalid MAC} -body {
::tls::mac -mac scrypt -key $test_key -data $test_data
} -result {Invalid MAC "scrypt"} -returnCodes {1}
::tls::mac -mac bogus -key $test_key -data $test_data
} -result {invalid MAC "bogus"} -returnCodes {1}
test MAC_Errors-18.5 {Too many args} -body {
::tls::mac too many command line args to pass the test without an error or failing
} -result {wrong # args: should be "::tls::mac ?-bin|-hex? ?-cipher name? ?-digest name? ?-key key? ?-mac name? [-channel chan | -command cmdName | -file filename | ?-data? data]"} -returnCodes {1}
# RFC 1321 Message Digest 5
|