mkfipsscr.pl 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572
  1. #!/usr/local/bin/perl -w
  2. my %fips_tests = (
  3. # FIPS test definitions
  4. # DSA tests
  5. "PQGGen" => "fips_dssvs pqg",
  6. "KeyPair" => "fips_dssvs keypair",
  7. "SigGen" => "fips_dssvs siggen",
  8. "SigVer" => "fips_dssvs sigver",
  9. # SHA tests
  10. "SHA1LongMsg" => "fips_shatest",
  11. "SHA1Monte" => "fips_shatest",
  12. "SHA1ShortMsg" => "fips_shatest",
  13. "SHA224LongMsg" => "fips_shatest",
  14. "SHA224Monte" => "fips_shatest",
  15. "SHA224ShortMsg" => "fips_shatest",
  16. "SHA256LongMsg" => "fips_shatest",
  17. "SHA256Monte" => "fips_shatest",
  18. "SHA256ShortMsg" => "fips_shatest",
  19. "SHA384LongMsg" => "fips_shatest",
  20. "SHA384Monte" => "fips_shatest",
  21. "SHA384ShortMsg" => "fips_shatest",
  22. "SHA512LongMsg" => "fips_shatest",
  23. "SHA512Monte" => "fips_shatest",
  24. "SHA512ShortMsg" => "fips_shatest",
  25. # HMAC
  26. "HMAC" => "fips_hmactest",
  27. # RAND tests
  28. "ANSI931_AES128MCT" => "fips_rngvs mct",
  29. "ANSI931_AES192MCT" => "fips_rngvs mct",
  30. "ANSI931_AES256MCT" => "fips_rngvs mct",
  31. "ANSI931_AES128VST" => "fips_rngvs vst",
  32. "ANSI931_AES192VST" => "fips_rngvs vst",
  33. "ANSI931_AES256VST" => "fips_rngvs vst",
  34. # RSA tests
  35. "SigGen15" => "fips_rsastest",
  36. "SigVer15" => "fips_rsavtest",
  37. "SigGenPSS" => "fips_rsastest -saltlen SALT",
  38. "SigVerPSS" => "fips_rsavtest -saltlen SALT",
  39. "SigGenRSA" => "fips_rsastest -x931",
  40. "SigVerRSA" => "fips_rsavtest -x931",
  41. "KeyGenRSA" => "fips_rsagtest",
  42. # AES tests
  43. "CBCGFSbox128" => "fips_aesavs -f",
  44. "CBCGFSbox192" => "fips_aesavs -f",
  45. "CBCGFSbox256" => "fips_aesavs -f",
  46. "CBCKeySbox128" => "fips_aesavs -f",
  47. "CBCKeySbox192" => "fips_aesavs -f",
  48. "CBCKeySbox256" => "fips_aesavs -f",
  49. "CBCMCT128" => "fips_aesavs -f",
  50. "CBCMCT192" => "fips_aesavs -f",
  51. "CBCMCT256" => "fips_aesavs -f",
  52. "CBCMMT128" => "fips_aesavs -f",
  53. "CBCMMT192" => "fips_aesavs -f",
  54. "CBCMMT256" => "fips_aesavs -f",
  55. "CBCVarKey128" => "fips_aesavs -f",
  56. "CBCVarKey192" => "fips_aesavs -f",
  57. "CBCVarKey256" => "fips_aesavs -f",
  58. "CBCVarTxt128" => "fips_aesavs -f",
  59. "CBCVarTxt192" => "fips_aesavs -f",
  60. "CBCVarTxt256" => "fips_aesavs -f",
  61. "CFB128GFSbox128" => "fips_aesavs -f",
  62. "CFB128GFSbox192" => "fips_aesavs -f",
  63. "CFB128GFSbox256" => "fips_aesavs -f",
  64. "CFB128KeySbox128" => "fips_aesavs -f",
  65. "CFB128KeySbox192" => "fips_aesavs -f",
  66. "CFB128KeySbox256" => "fips_aesavs -f",
  67. "CFB128MCT128" => "fips_aesavs -f",
  68. "CFB128MCT192" => "fips_aesavs -f",
  69. "CFB128MCT256" => "fips_aesavs -f",
  70. "CFB128MMT128" => "fips_aesavs -f",
  71. "CFB128MMT192" => "fips_aesavs -f",
  72. "CFB128MMT256" => "fips_aesavs -f",
  73. "CFB128VarKey128" => "fips_aesavs -f",
  74. "CFB128VarKey192" => "fips_aesavs -f",
  75. "CFB128VarKey256" => "fips_aesavs -f",
  76. "CFB128VarTxt128" => "fips_aesavs -f",
  77. "CFB128VarTxt192" => "fips_aesavs -f",
  78. "CFB128VarTxt256" => "fips_aesavs -f",
  79. "CFB8GFSbox128" => "fips_aesavs -f",
  80. "CFB8GFSbox192" => "fips_aesavs -f",
  81. "CFB8GFSbox256" => "fips_aesavs -f",
  82. "CFB8KeySbox128" => "fips_aesavs -f",
  83. "CFB8KeySbox192" => "fips_aesavs -f",
  84. "CFB8KeySbox256" => "fips_aesavs -f",
  85. "CFB8MCT128" => "fips_aesavs -f",
  86. "CFB8MCT192" => "fips_aesavs -f",
  87. "CFB8MCT256" => "fips_aesavs -f",
  88. "CFB8MMT128" => "fips_aesavs -f",
  89. "CFB8MMT192" => "fips_aesavs -f",
  90. "CFB8MMT256" => "fips_aesavs -f",
  91. "CFB8VarKey128" => "fips_aesavs -f",
  92. "CFB8VarKey192" => "fips_aesavs -f",
  93. "CFB8VarKey256" => "fips_aesavs -f",
  94. "CFB8VarTxt128" => "fips_aesavs -f",
  95. "CFB8VarTxt192" => "fips_aesavs -f",
  96. "CFB8VarTxt256" => "fips_aesavs -f",
  97. #"CFB1GFSbox128" => "fips_aesavs -f",
  98. #"CFB1GFSbox192" => "fips_aesavs -f",
  99. #"CFB1GFSbox256" => "fips_aesavs -f",
  100. #"CFB1KeySbox128" => "fips_aesavs -f",
  101. #"CFB1KeySbox192" => "fips_aesavs -f",
  102. #"CFB1KeySbox256" => "fips_aesavs -f",
  103. #"CFB1MCT128" => "fips_aesavs -f",
  104. #"CFB1MCT192" => "fips_aesavs -f",
  105. #"CFB1MCT256" => "fips_aesavs -f",
  106. #"CFB1MMT128" => "fips_aesavs -f",
  107. #"CFB1MMT192" => "fips_aesavs -f",
  108. #"CFB1MMT256" => "fips_aesavs -f",
  109. #"CFB1VarKey128" => "fips_aesavs -f",
  110. #"CFB1VarKey192" => "fips_aesavs -f",
  111. #"CFB1VarKey256" => "fips_aesavs -f",
  112. #"CFB1VarTxt128" => "fips_aesavs -f",
  113. #"CFB1VarTxt192" => "fips_aesavs -f",
  114. #"CFB1VarTxt256" => "fips_aesavs -f",
  115. "ECBGFSbox128" => "fips_aesavs -f",
  116. "ECBGFSbox192" => "fips_aesavs -f",
  117. "ECBGFSbox256" => "fips_aesavs -f",
  118. "ECBKeySbox128" => "fips_aesavs -f",
  119. "ECBKeySbox192" => "fips_aesavs -f",
  120. "ECBKeySbox256" => "fips_aesavs -f",
  121. "ECBMCT128" => "fips_aesavs -f",
  122. "ECBMCT192" => "fips_aesavs -f",
  123. "ECBMCT256" => "fips_aesavs -f",
  124. "ECBMMT128" => "fips_aesavs -f",
  125. "ECBMMT192" => "fips_aesavs -f",
  126. "ECBMMT256" => "fips_aesavs -f",
  127. "ECBVarKey128" => "fips_aesavs -f",
  128. "ECBVarKey192" => "fips_aesavs -f",
  129. "ECBVarKey256" => "fips_aesavs -f",
  130. "ECBVarTxt128" => "fips_aesavs -f",
  131. "ECBVarTxt192" => "fips_aesavs -f",
  132. "ECBVarTxt256" => "fips_aesavs -f",
  133. "OFBGFSbox128" => "fips_aesavs -f",
  134. "OFBGFSbox192" => "fips_aesavs -f",
  135. "OFBGFSbox256" => "fips_aesavs -f",
  136. "OFBKeySbox128" => "fips_aesavs -f",
  137. "OFBKeySbox192" => "fips_aesavs -f",
  138. "OFBKeySbox256" => "fips_aesavs -f",
  139. "OFBMCT128" => "fips_aesavs -f",
  140. "OFBMCT192" => "fips_aesavs -f",
  141. "OFBMCT256" => "fips_aesavs -f",
  142. "OFBMMT128" => "fips_aesavs -f",
  143. "OFBMMT192" => "fips_aesavs -f",
  144. "OFBMMT256" => "fips_aesavs -f",
  145. "OFBVarKey128" => "fips_aesavs -f",
  146. "OFBVarKey192" => "fips_aesavs -f",
  147. "OFBVarKey256" => "fips_aesavs -f",
  148. "OFBVarTxt128" => "fips_aesavs -f",
  149. "OFBVarTxt192" => "fips_aesavs -f",
  150. "OFBVarTxt256" => "fips_aesavs -f",
  151. # Triple DES tests
  152. "TCBCinvperm" => "fips_desmovs -f",
  153. "TCBCMMT1" => "fips_desmovs -f",
  154. "TCBCMMT2" => "fips_desmovs -f",
  155. "TCBCMMT3" => "fips_desmovs -f",
  156. "TCBCMonte1" => "fips_desmovs -f",
  157. "TCBCMonte2" => "fips_desmovs -f",
  158. "TCBCMonte3" => "fips_desmovs -f",
  159. "TCBCpermop" => "fips_desmovs -f",
  160. "TCBCsubtab" => "fips_desmovs -f",
  161. "TCBCvarkey" => "fips_desmovs -f",
  162. "TCBCvartext" => "fips_desmovs -f",
  163. "TCFB64invperm" => "fips_desmovs -f",
  164. "TCFB64MMT1" => "fips_desmovs -f",
  165. "TCFB64MMT2" => "fips_desmovs -f",
  166. "TCFB64MMT3" => "fips_desmovs -f",
  167. "TCFB64Monte1" => "fips_desmovs -f",
  168. "TCFB64Monte2" => "fips_desmovs -f",
  169. "TCFB64Monte3" => "fips_desmovs -f",
  170. "TCFB64permop" => "fips_desmovs -f",
  171. "TCFB64subtab" => "fips_desmovs -f",
  172. "TCFB64varkey" => "fips_desmovs -f",
  173. "TCFB64vartext" => "fips_desmovs -f",
  174. "TCFB8invperm" => "fips_desmovs -f",
  175. "TCFB8MMT1" => "fips_desmovs -f",
  176. "TCFB8MMT2" => "fips_desmovs -f",
  177. "TCFB8MMT3" => "fips_desmovs -f",
  178. "TCFB8Monte1" => "fips_desmovs -f",
  179. "TCFB8Monte2" => "fips_desmovs -f",
  180. "TCFB8Monte3" => "fips_desmovs -f",
  181. "TCFB8permop" => "fips_desmovs -f",
  182. "TCFB8subtab" => "fips_desmovs -f",
  183. "TCFB8varkey" => "fips_desmovs -f",
  184. "TCFB8vartext" => "fips_desmovs -f",
  185. "TECBinvperm" => "fips_desmovs -f",
  186. "TECBMMT1" => "fips_desmovs -f",
  187. "TECBMMT2" => "fips_desmovs -f",
  188. "TECBMMT3" => "fips_desmovs -f",
  189. "TECBMonte1" => "fips_desmovs -f",
  190. "TECBMonte2" => "fips_desmovs -f",
  191. "TECBMonte3" => "fips_desmovs -f",
  192. "TECBpermop" => "fips_desmovs -f",
  193. "TECBsubtab" => "fips_desmovs -f",
  194. "TECBvarkey" => "fips_desmovs -f",
  195. "TECBvartext" => "fips_desmovs -f",
  196. "TOFBinvperm" => "fips_desmovs -f",
  197. "TOFBMMT1" => "fips_desmovs -f",
  198. "TOFBMMT2" => "fips_desmovs -f",
  199. "TOFBMMT3" => "fips_desmovs -f",
  200. "TOFBMonte1" => "fips_desmovs -f",
  201. "TOFBMonte2" => "fips_desmovs -f",
  202. "TOFBMonte3" => "fips_desmovs -f",
  203. "TOFBpermop" => "fips_desmovs -f",
  204. "TOFBsubtab" => "fips_desmovs -f",
  205. "TOFBvarkey" => "fips_desmovs -f",
  206. "TOFBvartext" => "fips_desmovs -f",
  207. "TCBCinvperm" => "fips_desmovs -f",
  208. "TCBCMMT1" => "fips_desmovs -f",
  209. "TCBCMMT2" => "fips_desmovs -f",
  210. "TCBCMMT3" => "fips_desmovs -f",
  211. "TCBCMonte1" => "fips_desmovs -f",
  212. "TCBCMonte2" => "fips_desmovs -f",
  213. "TCBCMonte3" => "fips_desmovs -f",
  214. "TCBCpermop" => "fips_desmovs -f",
  215. "TCBCsubtab" => "fips_desmovs -f",
  216. "TCBCvarkey" => "fips_desmovs -f",
  217. "TCBCvartext" => "fips_desmovs -f",
  218. "TCFB64invperm" => "fips_desmovs -f",
  219. "TCFB64MMT1" => "fips_desmovs -f",
  220. "TCFB64MMT2" => "fips_desmovs -f",
  221. "TCFB64MMT3" => "fips_desmovs -f",
  222. "TCFB64Monte1" => "fips_desmovs -f",
  223. "TCFB64Monte2" => "fips_desmovs -f",
  224. "TCFB64Monte3" => "fips_desmovs -f",
  225. "TCFB64permop" => "fips_desmovs -f",
  226. "TCFB64subtab" => "fips_desmovs -f",
  227. "TCFB64varkey" => "fips_desmovs -f",
  228. "TCFB64vartext" => "fips_desmovs -f",
  229. "TCFB8invperm" => "fips_desmovs -f",
  230. "TCFB8MMT1" => "fips_desmovs -f",
  231. "TCFB8MMT2" => "fips_desmovs -f",
  232. "TCFB8MMT3" => "fips_desmovs -f",
  233. "TCFB8Monte1" => "fips_desmovs -f",
  234. "TCFB8Monte2" => "fips_desmovs -f",
  235. "TCFB8Monte3" => "fips_desmovs -f",
  236. "TCFB8permop" => "fips_desmovs -f",
  237. "TCFB8subtab" => "fips_desmovs -f",
  238. "TCFB8varkey" => "fips_desmovs -f",
  239. "TCFB8vartext" => "fips_desmovs -f",
  240. "TECBinvperm" => "fips_desmovs -f",
  241. "TECBMMT1" => "fips_desmovs -f",
  242. "TECBMMT2" => "fips_desmovs -f",
  243. "TECBMMT3" => "fips_desmovs -f",
  244. "TECBMonte1" => "fips_desmovs -f",
  245. "TECBMonte2" => "fips_desmovs -f",
  246. "TECBMonte3" => "fips_desmovs -f",
  247. "TECBpermop" => "fips_desmovs -f",
  248. "TECBsubtab" => "fips_desmovs -f",
  249. "TECBvarkey" => "fips_desmovs -f",
  250. "TECBvartext" => "fips_desmovs -f",
  251. "TOFBinvperm" => "fips_desmovs -f",
  252. "TOFBMMT1" => "fips_desmovs -f",
  253. "TOFBMMT2" => "fips_desmovs -f",
  254. "TOFBMMT3" => "fips_desmovs -f",
  255. "TOFBMonte1" => "fips_desmovs -f",
  256. "TOFBMonte2" => "fips_desmovs -f",
  257. "TOFBMonte3" => "fips_desmovs -f",
  258. "TOFBpermop" => "fips_desmovs -f",
  259. "TOFBsubtab" => "fips_desmovs -f",
  260. "TOFBvarkey" => "fips_desmovs -f",
  261. "TOFBvartext" => "fips_desmovs -f"
  262. );
  263. my $win32 = 0;
  264. my $onedir = 0;
  265. my $filter = "";
  266. my $tvdir;
  267. my $tprefix;
  268. my $shwrap_prefix;
  269. my $debug = 0;
  270. my $quiet = 0;
  271. my $rspdir = "rsp";
  272. foreach (@ARGV)
  273. {
  274. if ($_ eq "--win32")
  275. {
  276. $win32 = 1;
  277. }
  278. if ($_ eq "--vxworks")
  279. {
  280. $vxworks = 1;
  281. }
  282. elsif ($_ eq "--onedir")
  283. {
  284. $onedir = 1;
  285. }
  286. elsif ($_ eq "--debug")
  287. {
  288. $debug = 1;
  289. }
  290. elsif ($_ eq "--quiet")
  291. {
  292. $quiet = 1;
  293. }
  294. elsif (/--dir=(.*)$/)
  295. {
  296. $tvdir = $1;
  297. }
  298. elsif (/--rspdir=(.*)$/)
  299. {
  300. $rspdir = $1;
  301. }
  302. elsif (/--tprefix=(.*)$/)
  303. {
  304. $tprefix = $1;
  305. }
  306. elsif (/--shwrap_prefix=(.*)$/)
  307. {
  308. $shwrap_prefix = $1;
  309. }
  310. elsif (/--filter=(.*)$/)
  311. {
  312. $filter = $1;
  313. }
  314. elsif (/--outfile=(.*)$/)
  315. {
  316. $outfile = $1;
  317. }
  318. }
  319. if ($win32 && $vxworks) {
  320. print STDERR "Can't specify both --win32 and --vxworks\n";
  321. exit(1);
  322. }
  323. $tvdir = "." unless defined $tvdir;
  324. if ($win32)
  325. {
  326. if (!defined $tprefix)
  327. {
  328. if ($onedir)
  329. {
  330. $tprefix = ".\\";
  331. }
  332. else
  333. {
  334. $tprefix = "..\\out32dll\\";
  335. }
  336. }
  337. $outfile = "fipstests.bat" unless defined $outfile;
  338. open(OUT, ">$outfile");
  339. print OUT <<END;
  340. \@echo off
  341. rem Test vector run script
  342. rem Auto generated by mkfipsscr.pl script
  343. rem Do not edit
  344. END
  345. }
  346. elsif ($vxworks)
  347. {
  348. # Always assume onedir.
  349. $tprefix = "" unless defined $tprefix;
  350. $outfile = "fipstests" unless defined $outfile;
  351. open(OUT, ">$outfile");
  352. print OUT <<END;
  353. # Test vector run script
  354. # Auto generated by mkfipsscr.pl script
  355. # Do not edit
  356. END
  357. }
  358. else
  359. {
  360. if ($onedir)
  361. {
  362. $tprefix = "./" unless defined $tprefix;
  363. $shwrap_prefix = "./" unless defined $shwrap_prefix;
  364. }
  365. else
  366. {
  367. $tprefix = "../test/" unless defined $tprefix;
  368. $shwrap_prefix = "../util/" unless defined $shwrap_prefix;
  369. }
  370. $outfile = "fipstests.sh" unless defined $outfile;
  371. open(OUT, ">$outfile");
  372. print OUT <<END;
  373. #!/bin/sh
  374. # Test vector run script
  375. # Auto generated by mkfipsscr.pl script
  376. # Do not edit
  377. END
  378. }
  379. my %fips_found;
  380. foreach (keys %fips_tests)
  381. {
  382. $fips_found{$_} = 0;
  383. }
  384. recurse_test($win32, $tprefix, $filter, $tvdir);
  385. while (($key, $value) = each %fips_found)
  386. {
  387. if ($value == 0)
  388. {
  389. print STDERR "WARNING: test file $key not found\n" unless $quiet;
  390. }
  391. elsif ($value > 1)
  392. {
  393. print STDERR "WARNING: test file $key found $value times\n" unless $quiet;
  394. }
  395. else
  396. {
  397. print STDERR "Found test file $key\n" if $debug;
  398. }
  399. }
  400. sub recurse_test
  401. {
  402. my ($win32, $tprefix, $filter, $dir) = @_;
  403. my $dirh;
  404. opendir($dirh, $dir);
  405. while ($_ = readdir($dirh))
  406. {
  407. next if ($_ eq "." || $_ eq "..");
  408. $_ = "$dir/$_";
  409. if (-f "$_")
  410. {
  411. next unless /$filter.*\.req$/i;
  412. if (/\/([^\/]*)\.req$/ && exists $fips_tests{$1})
  413. {
  414. $fips_found{$1}++;
  415. test_line($win32, $_, $tprefix, $fips_tests{$1});
  416. }
  417. elsif (! /SHAmix\.req$/)
  418. {
  419. print STDERR "WARNING: unrecognized filename $_\n";
  420. }
  421. }
  422. elsif (-d "$_")
  423. {
  424. if (/$filter.*req$/i)
  425. {
  426. test_dir($win32, $_);
  427. }
  428. recurse_test($win32, $tprefix, $filter, $_);
  429. }
  430. }
  431. closedir($dirh);
  432. }
  433. sub test_dir
  434. {
  435. my ($win32, $req) = @_;
  436. my $rsp = $req;
  437. $rsp =~ s/req$/$rspdir/;
  438. if ($win32)
  439. {
  440. $rsp =~ tr|/|\\|;
  441. $req =~ tr|/|\\|;
  442. print OUT <<END;
  443. echo Running tests in $req
  444. if exist "$rsp" rd /s /q "$rsp"
  445. md "$rsp"
  446. END
  447. }
  448. elsif ($vxworks)
  449. {
  450. print OUT <<END;
  451. echo Running tests in "$req"
  452. rm -r "$rsp"
  453. mkdir "$rsp"
  454. END
  455. }
  456. else
  457. {
  458. print OUT <<END;
  459. echo Running tests in "$req"
  460. rm -rf "$rsp"
  461. mkdir "$rsp"
  462. END
  463. }
  464. }
  465. sub test_line
  466. {
  467. my ($win32, $req, $tprefix, $tcmd) = @_;
  468. my $rsp = $req;
  469. $rsp =~ s/req\/([^\/]*).req$/$rspdir\/$1.rsp/;
  470. if ($tcmd =~ /-f$/)
  471. {
  472. if ($win32)
  473. {
  474. $req =~ tr|/|\\|;
  475. $rsp =~ tr|/|\\|;
  476. print OUT "$tprefix$tcmd \"$req\" \"$rsp\"\n";
  477. }
  478. elsif ($vxworks)
  479. {
  480. print OUT "run $tprefix$tcmd \"$req\" \"$rsp\"\n";
  481. }
  482. else
  483. {
  484. print OUT <<END;
  485. ${shwrap_prefix}shlib_wrap.sh $tprefix$tcmd "$req" "$rsp" || { echo "$req failure" ; exit 1
  486. }
  487. END
  488. }
  489. return;
  490. }
  491. if ($tcmd =~ /SALT$/)
  492. {
  493. open (IN, $req) || die "Can't Open File $req";
  494. my $saltlen;
  495. while (<IN>)
  496. {
  497. if (/^\s*#\s*salt\s+len:\s+(\d+)\s+$/i)
  498. {
  499. my $sl = $1;
  500. print STDERR "$req salt length $sl\n" if $debug;
  501. $tcmd =~ s/SALT$/$sl/;
  502. last;
  503. }
  504. }
  505. close IN;
  506. if ($tcmd =~ /SALT$/)
  507. {
  508. die "Can't detect salt length for $req";
  509. }
  510. }
  511. if ($win32)
  512. {
  513. $req =~ tr|/|\\|;
  514. $rsp =~ tr|/|\\|;
  515. print OUT "$tprefix$tcmd < \"$req\" > \"$rsp\"\n";
  516. }
  517. elsif ($vxworks)
  518. {
  519. print OUT "run $tprefix$tcmd \"$req\" \"$rsp\"\n";
  520. }
  521. else
  522. {
  523. print OUT <<END;
  524. ${shwrap_prefix}shlib_wrap.sh $tprefix$tcmd < "$req" > "$rsp" || { echo "$req failure" ; exit 1; }
  525. END
  526. }
  527. }