]> www.wagner.pp.ru Git - openssl-gost/engine.git/blob - tcl_tests/getengine.tcl
tcl_tests: ca.try: Ignore openssl crl exit status for 'corrupted CRL' test
[openssl-gost/engine.git] / tcl_tests / getengine.tcl
1 #!/usr/bin/tclsh
2 lappend auto_path .
3 package require ossltest
4
5 proc getConfigLine {var {section ""}} {
6    global config
7    if {[string length $section]} {
8                 if {[regexp -indices "\n\\s*\\\[\\s*$section\\s*\\\]\\s*\n" $config start]} {
9                         set start [lindex $start 1]
10                 } else {
11                         return -code error "Section $section is not found"
12                 }       
13         } else {
14                 set start 0
15         }
16         if {[regexp -indices "\n\\s*\\\[\[^\n\]+\\\]\\s*\n" [string range $config $start end] end]} {
17                 set end [expr $start+[lindex $end 0]]
18         } else {
19                 set end end
20         }
21         if {![regexp "\n\\s*$var\\s*=\\s*(\\S\[^\n\]+?)\\s*\n" "\n[string range $config $start $end]" => value]} {
22                 return -code error "No variable $var in section $section"
23         }       
24         return $value
25 }
26
27 set config [getConfig] 
28
29 set openssl_def [getConfigLine openssl_conf]
30
31 set engine_section [getConfigLine {[^#]+}  [getConfigLine engines $openssl_def ]]
32
33 puts [getConfigLine engine_id $engine_section]
34
35
36
37