progs.pl revision 55714
1178580Simp#!/usr/local/bin/perl
2178580Simp
3178580Simpprint "/* This file was generated by progs.pl. */\n\n";
4178580Simp
5178580Simpgrep(s/^asn1pars$/asn1parse/,@ARGV);
6178580Simp
7178580Simpforeach (@ARGV)
8178580Simp	{ printf "extern int %s_main(int argc,char *argv[]);\n",$_; }
9178580Simp
10178580Simpprint <<'EOF';
11178580Simp
12178580Simp#ifdef SSLEAY_SRC  /* Defined only in openssl.c. */
13178580Simp
14178580Simp#define FUNC_TYPE_GENERAL	1
15178580Simp#define FUNC_TYPE_MD		2
16178580Simp#define FUNC_TYPE_CIPHER	3
17178580Simp
18178580Simptypedef struct {
19178580Simp	int type;
20178580Simp	char *name;
21178580Simp	int (*func)();
22178580Simp	} FUNCTION;
23178580Simp
24178580SimpFUNCTION functions[] = {
25178580SimpEOF
26178580Simp
27178580Simpforeach (@ARGV)
28178580Simp	{
29178580Simp	push(@files,$_);
30178580Simp	$str="\t{FUNC_TYPE_GENERAL,\"$_\",${_}_main},\n";
31178580Simp	if (($_ =~ /^s_/) || ($_ =~ /^ciphers$/))
32178580Simp		{ print "#if !defined(NO_SOCK) && !(defined(NO_SSL2) && defined(O_SSL3))\n${str}#endif\n"; }
33178580Simp	elsif ( ($_ =~ /^rsa$/) || ($_ =~ /^genrsa$/) )
34178580Simp		{ print "#ifndef NO_RSA\n${str}#endif\n";  }
35178580Simp	elsif ( ($_ =~ /^dsa$/) || ($_ =~ /^gendsa$/) || ($_ =~ /^dsaparam$/))
36178580Simp		{ print "#ifndef NO_DSA\n${str}#endif\n"; }
37178580Simp	elsif ( ($_ =~ /^dh$/) || ($_ =~ /^gendh$/))
38178580Simp		{ print "#ifndef NO_DH\n${str}#endif\n"; }
39178580Simp	else
40178580Simp		{ print $str; }
41178580Simp	}
42178580Simp
43178580Simpforeach ("md2","md5","sha","sha1","mdc2","rmd160")
44178580Simp	{
45178580Simp	push(@files,$_);
46178580Simp	printf "\t{FUNC_TYPE_MD,\"%s\",dgst_main},\n",$_;
47178580Simp	}
48178580Simp
49178580Simpforeach (
50178580Simp	"base64",
51178580Simp	"des", "des3", "desx", "idea", "rc4", "rc2","bf","cast","rc5",
52	"des-ecb", "des-ede",    "des-ede3",
53	"des-cbc", "des-ede-cbc","des-ede3-cbc",
54	"des-cfb", "des-ede-cfb","des-ede3-cfb",
55	"des-ofb", "des-ede-ofb","des-ede3-ofb",
56	"idea-cbc","idea-ecb",   "idea-cfb", "idea-ofb",
57	"rc2-cbc", "rc2-ecb",    "rc2-cfb",  "rc2-ofb",
58	"bf-cbc",  "bf-ecb",     "bf-cfb",   "bf-ofb",
59	"cast5-cbc","cast5-ecb", "cast5-cfb","cast5-ofb",
60	"cast-cbc", "rc5-cbc",   "rc5-ecb",  "rc5-cfb",  "rc5-ofb")
61	{
62	push(@files,$_);
63
64	$t=sprintf("\t{FUNC_TYPE_CIPHER,\"%s\",enc_main},\n",$_);
65	if    ($_ =~ /des/)  { $t="#ifndef NO_DES\n${t}#endif\n"; }
66	elsif ($_ =~ /idea/) { $t="#ifndef NO_IDEA\n${t}#endif\n"; }
67	elsif ($_ =~ /rc4/)  { $t="#ifndef NO_RC4\n${t}#endif\n"; }
68	elsif ($_ =~ /rc2/)  { $t="#ifndef NO_RC2\n${t}#endif\n"; }
69	elsif ($_ =~ /bf/)   { $t="#ifndef NO_BF\n${t}#endif\n"; }
70	elsif ($_ =~ /cast/) { $t="#ifndef NO_CAST\n${t}#endif\n"; }
71	elsif ($_ =~ /rc5/)  { $t="#ifndef NO_RC5\n${t}#endif\n"; }
72	print $t;
73	}
74
75print "\t{0,NULL,NULL}\n\t};\n";
76print "#endif\n\n";
77
78