]> git.ipfire.org Git - thirdparty/openssl.git/blame - apps/g_ssleay.pl
Import of old SSLeay release: SSLeay 0.9.0b
[thirdparty/openssl.git] / apps / g_ssleay.pl
CommitLineData
d02b48c6
RE
1#!/usr/local/bin/perl
2
3$mkprog='mklinks';
4$rmprog='rmlinks';
5
6print "#ifndef NOPROTO\n";
7
8grep(s/^asn1pars$/asn1parse/,@ARGV);
9
10foreach (@ARGV)
11 { printf "extern int %s_main(int argc,char *argv[]);\n",$_; }
12print "#else\n";
13foreach (@ARGV)
14 { printf "extern int %s_main();\n",$_; }
15print "#endif\n";
16
17
18print <<'EOF';
19
20#ifdef SSLEAY_SRC
21
22#define FUNC_TYPE_GENERAL 1
23#define FUNC_TYPE_MD 2
24#define FUNC_TYPE_CIPHER 3
25
26typedef struct {
27 int type;
28 char *name;
29 int (*func)();
30 } FUNCTION;
31
32FUNCTION functions[] = {
33EOF
34
35foreach (@ARGV)
36 {
37 push(@files,$_);
38 $str="\t{FUNC_TYPE_GENERAL,\"$_\",${_}_main},\n";
39 if (($_ =~ /^s_/) || ($_ =~ /^ciphers$/))
40 { print "#if !defined(NO_SOCK) && !(defined(NO_SSL2) && defined(O_SSL3))\n${str}#endif\n"; }
41 elsif ( ($_ =~ /^rsa$/) || ($_ =~ /^genrsa$/) ||
42 ($_ =~ /^req$/) || ($_ =~ /^ca$/) || ($_ =~ /^x509$/))
43 { print "#ifndef NO_RSA\n${str}#endif\n"; }
44 elsif ( ($_ =~ /^dsa$/) || ($_ =~ /^gendsa$/) || ($_ =~ /^dsaparam$/))
45 { print "#ifndef NO_DSA\n${str}#endif\n"; }
46 elsif ( ($_ =~ /^dh$/) || ($_ =~ /^gendh$/))
47 { print "#ifndef NO_DH\n${str}#endif\n"; }
48 else
49 { print $str; }
50 }
51
52foreach ("md2","md5","sha","sha1","mdc2")
53 {
54 push(@files,$_);
55 printf "\t{FUNC_TYPE_MD,\"%s\",dgst_main},\n",$_;
56 }
57
58foreach (
59 "base64",
58964a49 60 "des", "des3", "desx", "idea", "rc4", "rc2","bf","cast","rc5",
d02b48c6
RE
61 "des-ecb", "des-ede", "des-ede3",
62 "des-cbc", "des-ede-cbc","des-ede3-cbc",
63 "des-cfb", "des-ede-cfb","des-ede3-cfb",
64 "des-ofb", "des-ede-ofb","des-ede3-ofb",
65 "idea-cbc","idea-ecb", "idea-cfb", "idea-ofb",
66 "rc2-cbc", "rc2-ecb", "rc2-cfb", "rc2-ofb",
58964a49
RE
67 "bf-cbc", "bf-ecb", "bf-cfb", "bf-ofb",
68 "cast5-cbc","cast5-ecb", "cast5-cfb","cast5-ofb",
69 "cast-cbc", "rc5-cbc", "rc5-ecb", "rc5-cfb", "rc5-ofb")
d02b48c6
RE
70 {
71 push(@files,$_);
72
73 $t=sprintf("\t{FUNC_TYPE_CIPHER,\"%s\",enc_main},\n",$_);
74 if ($_ =~ /des/) { $t="#ifndef NO_DES\n${t}#endif\n"; }
75 elsif ($_ =~ /idea/) { $t="#ifndef NO_IDEA\n${t}#endif\n"; }
76 elsif ($_ =~ /rc4/) { $t="#ifndef NO_RC4\n${t}#endif\n"; }
77 elsif ($_ =~ /rc2/) { $t="#ifndef NO_RC2\n${t}#endif\n"; }
78 elsif ($_ =~ /bf/) { $t="#ifndef NO_BLOWFISH\n${t}#endif\n"; }
58964a49
RE
79 elsif ($_ =~ /cast/) { $t="#ifndef NO_CAST\n${t}#endif\n"; }
80 elsif ($_ =~ /rc5/) { $t="#ifndef NO_RC5\n${t}#endif\n"; }
d02b48c6
RE
81 print $t;
82 }
83
84print "\t{0,NULL,NULL}\n\t};\n";
85print "#endif\n\n";
86
87open(OUT,">$mkprog") || die "unable to open '$prog':$!\n";
88print OUT "#!/bin/sh\nfor i in ";
89foreach (@files)
90 { print OUT $_." "; }
91print OUT <<'EOF';
92
93do
94echo making symlink for $i
95/bin/rm -f $i
96ln -s ssleay $i
97done
98EOF
99close(OUT);
100chmod(0755,$mkprog);
101
102open(OUT,">$rmprog") || die "unable to open '$prog':$!\n";
103print OUT "#!/bin/sh\nfor i in ";
104foreach (@files)
105 { print OUT $_." "; }
106print OUT <<'EOF';
107
108do
109echo removing $i
110/bin/rm -f $i
111done
112EOF
113close(OUT);
114chmod(0755,$rmprog);