diff options
author | markus <> | 2002-09-05 12:51:52 +0000 |
---|---|---|
committer | markus <> | 2002-09-05 12:51:52 +0000 |
commit | b200d1ec45aafc7c92b197a4b605e34834d74f1d (patch) | |
tree | 2ac47a569cf091151154089c2da1ba18b3701fd6 | |
parent | fc21fc70b816bb7340331c8ce53fd71211879700 (diff) | |
parent | 5514995a9d5ed91db089875adb509c7781357c0e (diff) | |
download | openbsd-b200d1ec45aafc7c92b197a4b605e34834d74f1d.tar.gz openbsd-b200d1ec45aafc7c92b197a4b605e34834d74f1d.tar.bz2 openbsd-b200d1ec45aafc7c92b197a4b605e34834d74f1d.zip |
This commit was generated by cvs2git to track changes on a CVS vendor
branch.
-rw-r--r-- | src/lib/libcrypto/opensslconf.h | 180 | ||||
-rw-r--r-- | src/lib/libcrypto/util/pod2mantest | 53 | ||||
-rw-r--r-- | src/lib/libcrypto/util/pod2mantest.pod | 15 | ||||
-rw-r--r-- | src/lib/libssl/src/VMS/tcpip_shr_decc.opt | 1 | ||||
-rw-r--r-- | src/lib/libssl/src/crypto/opensslconf.h | 180 | ||||
-rw-r--r-- | src/lib/libssl/src/demos/engines/rsaref/Makefile | 119 | ||||
-rw-r--r-- | src/lib/libssl/src/demos/engines/rsaref/README | 22 | ||||
-rw-r--r-- | src/lib/libssl/src/demos/engines/rsaref/build.com | 85 | ||||
-rw-r--r-- | src/lib/libssl/src/demos/engines/rsaref/rsaref.c | 682 | ||||
-rw-r--r-- | src/lib/libssl/src/demos/engines/rsaref/rsaref.ec | 8 | ||||
-rw-r--r-- | src/lib/libssl/src/demos/engines/rsaref/rsaref_err.c | 161 | ||||
-rw-r--r-- | src/lib/libssl/src/demos/engines/rsaref/rsaref_err.h | 109 | ||||
-rw-r--r-- | src/lib/libssl/src/util/pod2mantest | 53 | ||||
-rw-r--r-- | src/lib/libssl/src/util/pod2mantest.pod | 15 |
14 files changed, 1683 insertions, 0 deletions
diff --git a/src/lib/libcrypto/opensslconf.h b/src/lib/libcrypto/opensslconf.h new file mode 100644 index 0000000000..c9756e47a3 --- /dev/null +++ b/src/lib/libcrypto/opensslconf.h | |||
@@ -0,0 +1,180 @@ | |||
1 | /* opensslconf.h */ | ||
2 | /* WARNING: Generated automatically from opensslconf.h.in by Configure. */ | ||
3 | |||
4 | /* OpenSSL was configured with the following options: */ | ||
5 | #ifndef OPENSSL_DOING_MAKEDEPEND | ||
6 | |||
7 | #ifndef OPENSSL_NO_KRB5 | ||
8 | # define OPENSSL_NO_KRB5 | ||
9 | #endif | ||
10 | |||
11 | #endif /* OPENSSL_DOING_MAKEDEPEND */ | ||
12 | |||
13 | /* The OPENSSL_NO_* macros are also defined as NO_* if the application | ||
14 | asks for it. This is a transient feature that is provided for those | ||
15 | who haven't had the time to do the appropriate changes in their | ||
16 | applications. */ | ||
17 | #ifdef OPENSSL_ALGORITHM_DEFINES | ||
18 | # if defined(OPENSSL_NO_KRB5) && !defined(NO_KRB5) | ||
19 | # define NO_KRB5 | ||
20 | # endif | ||
21 | #endif | ||
22 | |||
23 | /* crypto/opensslconf.h.in */ | ||
24 | |||
25 | /* Generate 80386 code? */ | ||
26 | #undef I386_ONLY | ||
27 | |||
28 | #if !(defined(VMS) || defined(__VMS)) /* VMS uses logical names instead */ | ||
29 | #if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR) | ||
30 | #define OPENSSLDIR "/usr/local/ssl" | ||
31 | #endif | ||
32 | #endif | ||
33 | |||
34 | #undef OPENSSL_UNISTD | ||
35 | #define OPENSSL_UNISTD <unistd.h> | ||
36 | |||
37 | #undef OPENSSL_EXPORT_VAR_AS_FUNCTION | ||
38 | |||
39 | #if defined(HEADER_IDEA_H) && !defined(IDEA_INT) | ||
40 | #define IDEA_INT unsigned int | ||
41 | #endif | ||
42 | |||
43 | #if defined(HEADER_MD2_H) && !defined(MD2_INT) | ||
44 | #define MD2_INT unsigned int | ||
45 | #endif | ||
46 | |||
47 | #if defined(HEADER_RC2_H) && !defined(RC2_INT) | ||
48 | /* I need to put in a mod for the alpha - eay */ | ||
49 | #define RC2_INT unsigned int | ||
50 | #endif | ||
51 | |||
52 | #if defined(HEADER_RC4_H) | ||
53 | #if !defined(RC4_INT) | ||
54 | /* using int types make the structure larger but make the code faster | ||
55 | * on most boxes I have tested - up to %20 faster. */ | ||
56 | /* | ||
57 | * I don't know what does "most" mean, but declaring "int" is a must on: | ||
58 | * - Intel P6 because partial register stalls are very expensive; | ||
59 | * - elder Alpha because it lacks byte load/store instructions; | ||
60 | */ | ||
61 | #define RC4_INT unsigned int | ||
62 | #endif | ||
63 | #if !defined(RC4_CHUNK) | ||
64 | /* | ||
65 | * This enables code handling data aligned at natural CPU word | ||
66 | * boundary. See crypto/rc4/rc4_enc.c for further details. | ||
67 | */ | ||
68 | #undef RC4_CHUNK | ||
69 | #endif | ||
70 | #endif | ||
71 | |||
72 | #if (defined(HEADER_DES_H) || defined(HEADER_DES_OLD_H)) && !defined(DES_LONG) | ||
73 | /* If this is set to 'unsigned int' on a DEC Alpha, this gives about a | ||
74 | * %20 speed up (longs are 8 bytes, int's are 4). */ | ||
75 | #ifndef DES_LONG | ||
76 | #define DES_LONG unsigned long | ||
77 | #endif | ||
78 | #endif | ||
79 | |||
80 | #if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H) | ||
81 | #define CONFIG_HEADER_BN_H | ||
82 | #undef BN_LLONG | ||
83 | |||
84 | /* Should we define BN_DIV2W here? */ | ||
85 | |||
86 | /* Only one for the following should be defined */ | ||
87 | /* The prime number generation stuff may not work when | ||
88 | * EIGHT_BIT but I don't care since I've only used this mode | ||
89 | * for debuging the bignum libraries */ | ||
90 | #undef SIXTY_FOUR_BIT_LONG | ||
91 | #undef SIXTY_FOUR_BIT | ||
92 | #define THIRTY_TWO_BIT | ||
93 | #undef SIXTEEN_BIT | ||
94 | #undef EIGHT_BIT | ||
95 | #endif | ||
96 | |||
97 | #if defined(HEADER_RC4_LOCL_H) && !defined(CONFIG_HEADER_RC4_LOCL_H) | ||
98 | #define CONFIG_HEADER_RC4_LOCL_H | ||
99 | /* if this is defined data[i] is used instead of *data, this is a %20 | ||
100 | * speedup on x86 */ | ||
101 | #undef RC4_INDEX | ||
102 | #endif | ||
103 | |||
104 | #if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H) | ||
105 | #define CONFIG_HEADER_BF_LOCL_H | ||
106 | #undef BF_PTR | ||
107 | #endif /* HEADER_BF_LOCL_H */ | ||
108 | |||
109 | #if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H) | ||
110 | #define CONFIG_HEADER_DES_LOCL_H | ||
111 | #ifndef DES_DEFAULT_OPTIONS | ||
112 | /* the following is tweaked from a config script, that is why it is a | ||
113 | * protected undef/define */ | ||
114 | #ifndef DES_PTR | ||
115 | #undef DES_PTR | ||
116 | #endif | ||
117 | |||
118 | /* This helps C compiler generate the correct code for multiple functional | ||
119 | * units. It reduces register dependancies at the expense of 2 more | ||
120 | * registers */ | ||
121 | #ifndef DES_RISC1 | ||
122 | #undef DES_RISC1 | ||
123 | #endif | ||
124 | |||
125 | #ifndef DES_RISC2 | ||
126 | #undef DES_RISC2 | ||
127 | #endif | ||
128 | |||
129 | #if defined(DES_RISC1) && defined(DES_RISC2) | ||
130 | YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!! | ||
131 | #endif | ||
132 | |||
133 | /* Unroll the inner loop, this sometimes helps, sometimes hinders. | ||
134 | * Very mucy CPU dependant */ | ||
135 | #ifndef DES_UNROLL | ||
136 | #undef DES_UNROLL | ||
137 | #endif | ||
138 | |||
139 | /* These default values were supplied by | ||
140 | * Peter Gutman <pgut001@cs.auckland.ac.nz> | ||
141 | * They are only used if nothing else has been defined */ | ||
142 | #if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL) | ||
143 | /* Special defines which change the way the code is built depending on the | ||
144 | CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find | ||
145 | even newer MIPS CPU's, but at the moment one size fits all for | ||
146 | optimization options. Older Sparc's work better with only UNROLL, but | ||
147 | there's no way to tell at compile time what it is you're running on */ | ||
148 | |||
149 | #if defined( sun ) /* Newer Sparc's */ | ||
150 | # define DES_PTR | ||
151 | # define DES_RISC1 | ||
152 | # define DES_UNROLL | ||
153 | #elif defined( __ultrix ) /* Older MIPS */ | ||
154 | # define DES_PTR | ||
155 | # define DES_RISC2 | ||
156 | # define DES_UNROLL | ||
157 | #elif defined( __osf1__ ) /* Alpha */ | ||
158 | # define DES_PTR | ||
159 | # define DES_RISC2 | ||
160 | #elif defined ( _AIX ) /* RS6000 */ | ||
161 | /* Unknown */ | ||
162 | #elif defined( __hpux ) /* HP-PA */ | ||
163 | /* Unknown */ | ||
164 | #elif defined( __aux ) /* 68K */ | ||
165 | /* Unknown */ | ||
166 | #elif defined( __dgux ) /* 88K (but P6 in latest boxes) */ | ||
167 | # define DES_UNROLL | ||
168 | #elif defined( __sgi ) /* Newer MIPS */ | ||
169 | # define DES_PTR | ||
170 | # define DES_RISC2 | ||
171 | # define DES_UNROLL | ||
172 | #elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */ | ||
173 | # define DES_PTR | ||
174 | # define DES_RISC1 | ||
175 | # define DES_UNROLL | ||
176 | #endif /* Systems-specific speed defines */ | ||
177 | #endif | ||
178 | |||
179 | #endif /* DES_DEFAULT_OPTIONS */ | ||
180 | #endif /* HEADER_DES_LOCL_H */ | ||
diff --git a/src/lib/libcrypto/util/pod2mantest b/src/lib/libcrypto/util/pod2mantest new file mode 100644 index 0000000000..79aefafac0 --- /dev/null +++ b/src/lib/libcrypto/util/pod2mantest | |||
@@ -0,0 +1,53 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | # This script is used by test/Makefile.ssl to check whether a sane 'pod2man' | ||
4 | # is installed. | ||
5 | # ('make install' should not try to run 'pod2man' if it does not exist or if | ||
6 | # it is a broken 'pod2man' version that is known to cause trouble. if we find | ||
7 | # the system 'pod2man' to be broken, we use our own copy instead) | ||
8 | # | ||
9 | # In any case, output an appropriate command line for running (or not | ||
10 | # running) pod2man. | ||
11 | |||
12 | |||
13 | IFS=: | ||
14 | try_without_dir=true | ||
15 | # First we try "pod2man", then "$dir/pod2man" for each item in $PATH. | ||
16 | for dir in dummy:$PATH; do | ||
17 | if [ "$try_without_dir" = true ]; then | ||
18 | # first iteration | ||
19 | pod2man=pod2man | ||
20 | try_without_dir=false | ||
21 | else | ||
22 | # second and later iterations | ||
23 | pod2man="$dir/pod2man" | ||
24 | if [ ! -f "$pod2man" ]; then # '-x' is not available on Ultrix | ||
25 | pod2man='' | ||
26 | fi | ||
27 | fi | ||
28 | |||
29 | if [ ! "$pod2man" = '' ]; then | ||
30 | failure=none | ||
31 | |||
32 | |||
33 | if "$pod2man" --section=1 --center=OpenSSL --release=dev pod2mantest.pod | grep '^MARKER - ' >/dev/null 2>&1; then | ||
34 | failure=MultilineTest | ||
35 | fi | ||
36 | |||
37 | |||
38 | if [ "$failure" = none ]; then | ||
39 | echo "$pod2man" | ||
40 | exit 0 | ||
41 | fi | ||
42 | |||
43 | echo "$pod2man does not work properly ('$failure' failed). Looking for another pod2man ..." >&2 | ||
44 | fi | ||
45 | done | ||
46 | |||
47 | echo "No working pod2man found. Consider installing a new version." >&2 | ||
48 | if [ "$1" = ignore ]; then | ||
49 | echo "As a workaround, we'll use a bundled old copy of pod2man.pl." >&2 | ||
50 | echo "util/pod2man.pl" | ||
51 | exit 0 | ||
52 | fi | ||
53 | exit 1 | ||
diff --git a/src/lib/libcrypto/util/pod2mantest.pod b/src/lib/libcrypto/util/pod2mantest.pod new file mode 100644 index 0000000000..5d2539a17f --- /dev/null +++ b/src/lib/libcrypto/util/pod2mantest.pod | |||
@@ -0,0 +1,15 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | foo, bar, | ||
6 | MARKER - test of multiline name section | ||
7 | |||
8 | =head1 DESCRIPTION | ||
9 | |||
10 | This is a test .pod file to see if we have a buggy pod2man or not. | ||
11 | If we have a buggy implementation, we will get a line matching the | ||
12 | regular expression "^ +MARKER - test of multiline name section *$" | ||
13 | at the end of the resulting document. | ||
14 | |||
15 | =cut | ||
diff --git a/src/lib/libssl/src/VMS/tcpip_shr_decc.opt b/src/lib/libssl/src/VMS/tcpip_shr_decc.opt new file mode 100644 index 0000000000..33b159e5f5 --- /dev/null +++ b/src/lib/libssl/src/VMS/tcpip_shr_decc.opt | |||
@@ -0,0 +1 @@ | |||
sys$share:tcpip$ipc_shr.exe/share | |||
diff --git a/src/lib/libssl/src/crypto/opensslconf.h b/src/lib/libssl/src/crypto/opensslconf.h new file mode 100644 index 0000000000..c9756e47a3 --- /dev/null +++ b/src/lib/libssl/src/crypto/opensslconf.h | |||
@@ -0,0 +1,180 @@ | |||
1 | /* opensslconf.h */ | ||
2 | /* WARNING: Generated automatically from opensslconf.h.in by Configure. */ | ||
3 | |||
4 | /* OpenSSL was configured with the following options: */ | ||
5 | #ifndef OPENSSL_DOING_MAKEDEPEND | ||
6 | |||
7 | #ifndef OPENSSL_NO_KRB5 | ||
8 | # define OPENSSL_NO_KRB5 | ||
9 | #endif | ||
10 | |||
11 | #endif /* OPENSSL_DOING_MAKEDEPEND */ | ||
12 | |||
13 | /* The OPENSSL_NO_* macros are also defined as NO_* if the application | ||
14 | asks for it. This is a transient feature that is provided for those | ||
15 | who haven't had the time to do the appropriate changes in their | ||
16 | applications. */ | ||
17 | #ifdef OPENSSL_ALGORITHM_DEFINES | ||
18 | # if defined(OPENSSL_NO_KRB5) && !defined(NO_KRB5) | ||
19 | # define NO_KRB5 | ||
20 | # endif | ||
21 | #endif | ||
22 | |||
23 | /* crypto/opensslconf.h.in */ | ||
24 | |||
25 | /* Generate 80386 code? */ | ||
26 | #undef I386_ONLY | ||
27 | |||
28 | #if !(defined(VMS) || defined(__VMS)) /* VMS uses logical names instead */ | ||
29 | #if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR) | ||
30 | #define OPENSSLDIR "/usr/local/ssl" | ||
31 | #endif | ||
32 | #endif | ||
33 | |||
34 | #undef OPENSSL_UNISTD | ||
35 | #define OPENSSL_UNISTD <unistd.h> | ||
36 | |||
37 | #undef OPENSSL_EXPORT_VAR_AS_FUNCTION | ||
38 | |||
39 | #if defined(HEADER_IDEA_H) && !defined(IDEA_INT) | ||
40 | #define IDEA_INT unsigned int | ||
41 | #endif | ||
42 | |||
43 | #if defined(HEADER_MD2_H) && !defined(MD2_INT) | ||
44 | #define MD2_INT unsigned int | ||
45 | #endif | ||
46 | |||
47 | #if defined(HEADER_RC2_H) && !defined(RC2_INT) | ||
48 | /* I need to put in a mod for the alpha - eay */ | ||
49 | #define RC2_INT unsigned int | ||
50 | #endif | ||
51 | |||
52 | #if defined(HEADER_RC4_H) | ||
53 | #if !defined(RC4_INT) | ||
54 | /* using int types make the structure larger but make the code faster | ||
55 | * on most boxes I have tested - up to %20 faster. */ | ||
56 | /* | ||
57 | * I don't know what does "most" mean, but declaring "int" is a must on: | ||
58 | * - Intel P6 because partial register stalls are very expensive; | ||
59 | * - elder Alpha because it lacks byte load/store instructions; | ||
60 | */ | ||
61 | #define RC4_INT unsigned int | ||
62 | #endif | ||
63 | #if !defined(RC4_CHUNK) | ||
64 | /* | ||
65 | * This enables code handling data aligned at natural CPU word | ||
66 | * boundary. See crypto/rc4/rc4_enc.c for further details. | ||
67 | */ | ||
68 | #undef RC4_CHUNK | ||
69 | #endif | ||
70 | #endif | ||
71 | |||
72 | #if (defined(HEADER_DES_H) || defined(HEADER_DES_OLD_H)) && !defined(DES_LONG) | ||
73 | /* If this is set to 'unsigned int' on a DEC Alpha, this gives about a | ||
74 | * %20 speed up (longs are 8 bytes, int's are 4). */ | ||
75 | #ifndef DES_LONG | ||
76 | #define DES_LONG unsigned long | ||
77 | #endif | ||
78 | #endif | ||
79 | |||
80 | #if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H) | ||
81 | #define CONFIG_HEADER_BN_H | ||
82 | #undef BN_LLONG | ||
83 | |||
84 | /* Should we define BN_DIV2W here? */ | ||
85 | |||
86 | /* Only one for the following should be defined */ | ||
87 | /* The prime number generation stuff may not work when | ||
88 | * EIGHT_BIT but I don't care since I've only used this mode | ||
89 | * for debuging the bignum libraries */ | ||
90 | #undef SIXTY_FOUR_BIT_LONG | ||
91 | #undef SIXTY_FOUR_BIT | ||
92 | #define THIRTY_TWO_BIT | ||
93 | #undef SIXTEEN_BIT | ||
94 | #undef EIGHT_BIT | ||
95 | #endif | ||
96 | |||
97 | #if defined(HEADER_RC4_LOCL_H) && !defined(CONFIG_HEADER_RC4_LOCL_H) | ||
98 | #define CONFIG_HEADER_RC4_LOCL_H | ||
99 | /* if this is defined data[i] is used instead of *data, this is a %20 | ||
100 | * speedup on x86 */ | ||
101 | #undef RC4_INDEX | ||
102 | #endif | ||
103 | |||
104 | #if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H) | ||
105 | #define CONFIG_HEADER_BF_LOCL_H | ||
106 | #undef BF_PTR | ||
107 | #endif /* HEADER_BF_LOCL_H */ | ||
108 | |||
109 | #if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H) | ||
110 | #define CONFIG_HEADER_DES_LOCL_H | ||
111 | #ifndef DES_DEFAULT_OPTIONS | ||
112 | /* the following is tweaked from a config script, that is why it is a | ||
113 | * protected undef/define */ | ||
114 | #ifndef DES_PTR | ||
115 | #undef DES_PTR | ||
116 | #endif | ||
117 | |||
118 | /* This helps C compiler generate the correct code for multiple functional | ||
119 | * units. It reduces register dependancies at the expense of 2 more | ||
120 | * registers */ | ||
121 | #ifndef DES_RISC1 | ||
122 | #undef DES_RISC1 | ||
123 | #endif | ||
124 | |||
125 | #ifndef DES_RISC2 | ||
126 | #undef DES_RISC2 | ||
127 | #endif | ||
128 | |||
129 | #if defined(DES_RISC1) && defined(DES_RISC2) | ||
130 | YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!! | ||
131 | #endif | ||
132 | |||
133 | /* Unroll the inner loop, this sometimes helps, sometimes hinders. | ||
134 | * Very mucy CPU dependant */ | ||
135 | #ifndef DES_UNROLL | ||
136 | #undef DES_UNROLL | ||
137 | #endif | ||
138 | |||
139 | /* These default values were supplied by | ||
140 | * Peter Gutman <pgut001@cs.auckland.ac.nz> | ||
141 | * They are only used if nothing else has been defined */ | ||
142 | #if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL) | ||
143 | /* Special defines which change the way the code is built depending on the | ||
144 | CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find | ||
145 | even newer MIPS CPU's, but at the moment one size fits all for | ||
146 | optimization options. Older Sparc's work better with only UNROLL, but | ||
147 | there's no way to tell at compile time what it is you're running on */ | ||
148 | |||
149 | #if defined( sun ) /* Newer Sparc's */ | ||
150 | # define DES_PTR | ||
151 | # define DES_RISC1 | ||
152 | # define DES_UNROLL | ||
153 | #elif defined( __ultrix ) /* Older MIPS */ | ||
154 | # define DES_PTR | ||
155 | # define DES_RISC2 | ||
156 | # define DES_UNROLL | ||
157 | #elif defined( __osf1__ ) /* Alpha */ | ||
158 | # define DES_PTR | ||
159 | # define DES_RISC2 | ||
160 | #elif defined ( _AIX ) /* RS6000 */ | ||
161 | /* Unknown */ | ||
162 | #elif defined( __hpux ) /* HP-PA */ | ||
163 | /* Unknown */ | ||
164 | #elif defined( __aux ) /* 68K */ | ||
165 | /* Unknown */ | ||
166 | #elif defined( __dgux ) /* 88K (but P6 in latest boxes) */ | ||
167 | # define DES_UNROLL | ||
168 | #elif defined( __sgi ) /* Newer MIPS */ | ||
169 | # define DES_PTR | ||
170 | # define DES_RISC2 | ||
171 | # define DES_UNROLL | ||
172 | #elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */ | ||
173 | # define DES_PTR | ||
174 | # define DES_RISC1 | ||
175 | # define DES_UNROLL | ||
176 | #endif /* Systems-specific speed defines */ | ||
177 | #endif | ||
178 | |||
179 | #endif /* DES_DEFAULT_OPTIONS */ | ||
180 | #endif /* HEADER_DES_LOCL_H */ | ||
diff --git a/src/lib/libssl/src/demos/engines/rsaref/Makefile b/src/lib/libssl/src/demos/engines/rsaref/Makefile new file mode 100644 index 0000000000..5fbcda3576 --- /dev/null +++ b/src/lib/libssl/src/demos/engines/rsaref/Makefile | |||
@@ -0,0 +1,119 @@ | |||
1 | LIBNAME= librsaref | ||
2 | SRC= rsaref.c | ||
3 | OBJ= rsaref.o | ||
4 | HEADER= rsaref.h | ||
5 | |||
6 | CC= gcc | ||
7 | PIC= -fPIC | ||
8 | CFLAGS= -g -I../../../include $(PIC) -DENGINE_DYNAMIC_SUPPORT | ||
9 | AR= ar r | ||
10 | RANLIB= ranlib | ||
11 | |||
12 | LIB= $(LIBNAME).a | ||
13 | SHLIB= $(LIBNAME).so | ||
14 | |||
15 | all: | ||
16 | @echo 'Please choose a system to build on:' | ||
17 | @echo '' | ||
18 | @echo 'tru64: Tru64 Unix, Digital Unix, Digital OSF/1' | ||
19 | @echo 'solaris: Solaris' | ||
20 | @echo 'irix: IRIX' | ||
21 | @echo 'hpux32: 32-bit HP/UX' | ||
22 | @echo 'hpux64: 64-bit HP/UX' | ||
23 | @echo 'aix: AIX' | ||
24 | @echo 'gnu: Generic GNU-based system (gcc and GNU ld)' | ||
25 | @echo '' | ||
26 | |||
27 | FORCE.install: | ||
28 | install: FORCE.install | ||
29 | cd install; \ | ||
30 | make -f unix/makefile CFLAGS='-I. -DPROTOTYPES=1 -O -c' RSAREFLIB=librsaref.a librsaref.a | ||
31 | |||
32 | FORCE.update: | ||
33 | update: FORCE.update | ||
34 | perl ../../../util/mkerr.pl -conf rsaref.ec \ | ||
35 | -nostatic -staticloader -write rsaref.c | ||
36 | |||
37 | gnu: install $(SHLIB).gnu | ||
38 | tru64: install $(SHLIB).tru64 | ||
39 | solaris: install $(SHLIB).solaris | ||
40 | irix: install $(SHLIB).irix | ||
41 | hpux32: install $(SHLIB).hpux32 | ||
42 | hpux64: install $(SHLIB).hpux64 | ||
43 | aix: install $(SHLIB).aix | ||
44 | |||
45 | $(LIB): $(OBJ) | ||
46 | $(AR) $(LIB) $(OBJ) | ||
47 | - $(RANLIB) $(LIB) | ||
48 | |||
49 | LINK_SO= \ | ||
50 | ld -r -o $(LIBNAME).o $$ALLSYMSFLAGS $(LIB) install/librsaref.a && \ | ||
51 | (nm -Pg $(LIBNAME).o | grep ' [BD] ' | cut -f1 -d' ' > $(LIBNAME).exp; \ | ||
52 | $$SHAREDCMD $$SHAREDFLAGS -o $(SHLIB) $(LIBNAME).o -L ../../.. -lcrypto -lc) | ||
53 | |||
54 | $(SHLIB).gnu: $(LIB) install/librsaref.a | ||
55 | ALLSYMSFLAGS='--whole-archive' \ | ||
56 | SHAREDFLAGS='-shared -Wl,-soname=$(SHLIB)' \ | ||
57 | SHAREDCMD='$(CC)'; \ | ||
58 | $(LINK_SO) | ||
59 | touch $(SHLIB).gnu | ||
60 | $(SHLIB).tru64: $(LIB) install/librsaref.a | ||
61 | ALLSYMSFLAGS='-all' \ | ||
62 | SHAREDFLAGS='-shared' \ | ||
63 | SHAREDCMD='$(CC)'; \ | ||
64 | $(LINK_SO) | ||
65 | touch $(SHLIB).tru64 | ||
66 | $(SHLIB).solaris: $(LIB) install/librsaref.a | ||
67 | ALLSYMSFLAGS='-z allextract' \ | ||
68 | SHAREDFLAGS='-G -h $(SHLIB)' \ | ||
69 | SHAREDCMD='$(CC)'; \ | ||
70 | $(LINK_SO) | ||
71 | touch $(SHLIB).solaris | ||
72 | $(SHLIB).irix: $(LIB) install/librsaref.a | ||
73 | ALLSYMSFLAGS='-all' \ | ||
74 | SHAREDFLAGS='-shared -Wl,-soname,$(SHLIB)' \ | ||
75 | SHAREDCMD='$(CC)'; \ | ||
76 | $(LINK_SO) | ||
77 | touch $(SHLIB).irix | ||
78 | $(SHLIB).hpux32: $(LIB) install/librsaref.a | ||
79 | ALLSYMSFLAGS='-Fl' \ | ||
80 | SHAREDFLAGS='+vnocompatwarnings -b -z +s +h $(SHLIB)' \ | ||
81 | SHAREDCMD='/usr/ccs/bin/ld'; \ | ||
82 | $(LINK_SO) | ||
83 | touch $(SHLIB).hpux32 | ||
84 | $(SHLIB).hpux64: $(LIB) install/librsaref.a | ||
85 | ALLSYMSFLAGS='+forceload' \ | ||
86 | SHAREDFLAGS='-b -z +h $(SHLIB)' \ | ||
87 | SHAREDCMD='/usr/ccs/bin/ld'; \ | ||
88 | $(LINK_SO) | ||
89 | touch $(SHLIB).hpux64 | ||
90 | $(SHLIB).aix: $(LIB) install/librsaref.a | ||
91 | ALLSYMSFLAGS='-bnogc' \ | ||
92 | SHAREDFLAGS='-G -bE:$(LIBNAME).exp -bM:SRE' \ | ||
93 | SHAREDCMD='$(CC)'; \ | ||
94 | $(LINK_SO) | ||
95 | touch $(SHLIB).aix | ||
96 | |||
97 | depend: | ||
98 | sed -e '/^# DO NOT DELETE.*/,$$d' < Makefile > Makefile.tmp | ||
99 | echo '# DO NOT DELETE THIS LINE -- make depend depends on it.' >> Makefile.tmp | ||
100 | gcc -M $(CFLAGS) $(SRC) >> Makefile.tmp | ||
101 | perl ../../../util/clean-depend.pl < Makefile.tmp > Makefile.new | ||
102 | rm -f Makefile.tmp Makefile | ||
103 | mv Makefile.new Makefile | ||
104 | |||
105 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
106 | |||
107 | rsaref.o: ../../../include/openssl/asn1.h ../../../include/openssl/bio.h | ||
108 | rsaref.o: ../../../include/openssl/bn.h ../../../include/openssl/crypto.h | ||
109 | rsaref.o: ../../../include/openssl/dh.h ../../../include/openssl/dsa.h | ||
110 | rsaref.o: ../../../include/openssl/e_os2.h ../../../include/openssl/engine.h | ||
111 | rsaref.o: ../../../include/openssl/err.h ../../../include/openssl/lhash.h | ||
112 | rsaref.o: ../../../include/openssl/opensslconf.h | ||
113 | rsaref.o: ../../../include/openssl/opensslv.h | ||
114 | rsaref.o: ../../../include/openssl/ossl_typ.h ../../../include/openssl/rand.h | ||
115 | rsaref.o: ../../../include/openssl/rsa.h ../../../include/openssl/safestack.h | ||
116 | rsaref.o: ../../../include/openssl/stack.h ../../../include/openssl/symhacks.h | ||
117 | rsaref.o: ../../../include/openssl/ui.h rsaref.c rsaref_err.c rsaref_err.h | ||
118 | rsaref.o: source/des.h source/global.h source/md2.h source/md5.h source/rsa.h | ||
119 | rsaref.o: source/rsaref.h | ||
diff --git a/src/lib/libssl/src/demos/engines/rsaref/README b/src/lib/libssl/src/demos/engines/rsaref/README new file mode 100644 index 0000000000..00b1f7473b --- /dev/null +++ b/src/lib/libssl/src/demos/engines/rsaref/README | |||
@@ -0,0 +1,22 @@ | |||
1 | librsaref.so is a demonstration dynamic engine that does RSA | ||
2 | operations using the old RSAref 2.0 implementation. | ||
3 | |||
4 | To make proper use of this engine, you must download RSAref 2.0 | ||
5 | (search the web for rsaref.tar.Z for example) and unpack it in this | ||
6 | directory, so you'll end up having the subdirectories "install" and | ||
7 | "source" among others. | ||
8 | |||
9 | To build, do the following: | ||
10 | |||
11 | make | ||
12 | |||
13 | This will list a number of available targets to choose from. Most of | ||
14 | them are architecture-specific. The exception is "gnu" which is to be | ||
15 | used on systems where GNU ld and gcc have been installed in such a way | ||
16 | that gcc uses GNU ld to link together programs and shared libraries. | ||
17 | |||
18 | The make file assumes you use gcc. To change that, just reassign CC: | ||
19 | |||
20 | make CC=cc | ||
21 | |||
22 | The result is librsaref.so, which you can copy to any place you wish. | ||
diff --git a/src/lib/libssl/src/demos/engines/rsaref/build.com b/src/lib/libssl/src/demos/engines/rsaref/build.com new file mode 100644 index 0000000000..b956912916 --- /dev/null +++ b/src/lib/libssl/src/demos/engines/rsaref/build.com | |||
@@ -0,0 +1,85 @@ | |||
1 | $! BUILD.COM -- Building procedure for the RSAref engine | ||
2 | $ | ||
3 | $ if f$search("source.dir") .eqs. "" - | ||
4 | .or. f$search("install.dir") .eqs. "" | ||
5 | $ then | ||
6 | $ write sys$error "RSAref 2.0 hasn't been properly extracted." | ||
7 | $ exit | ||
8 | $ endif | ||
9 | $ | ||
10 | $ _save_default = f$environment("default") | ||
11 | $ set default [.install] | ||
12 | $ files := desc,digit,md2c,md5c,nn,prime,- | ||
13 | rsa,r_encode,r_dh,r_enhanc,r_keygen,r_random,- | ||
14 | r_stdlib | ||
15 | $ delete rsaref.olb;* | ||
16 | $ library/create/object rsaref.olb | ||
17 | $ files_i = 0 | ||
18 | $ rsaref_loop: | ||
19 | $ files_e = f$edit(f$element(files_i,",",files),"trim") | ||
20 | $ files_i = files_i + 1 | ||
21 | $ if files_e .eqs. "," then goto rsaref_loop_end | ||
22 | $ cc/include=([-.source],[])/define=PROTOTYPES=1/object=[]'files_e'.obj - | ||
23 | [-.source]'files_e'.c | ||
24 | $ library/replace/object rsaref.olb 'files_e'.obj | ||
25 | $ goto rsaref_loop | ||
26 | $ rsaref_loop_end: | ||
27 | $ | ||
28 | $ set default [-] | ||
29 | $ define/user openssl [---.include.openssl] | ||
30 | $ cc/define=ENGINE_DYNAMIC_SUPPORT rsaref.c | ||
31 | $ | ||
32 | $ if f$getsyi("CPU") .ge. 128 | ||
33 | $ then | ||
34 | $ link/share=librsaref.exe sys$input:/option | ||
35 | []rsaref.obj | ||
36 | [.install]rsaref.olb/lib | ||
37 | [---.axp.exe.crypto]libcrypto.olb/lib | ||
38 | symbol_vector=(bind_engine=procedure,v_check=procedure) | ||
39 | $ else | ||
40 | $ macro/object=rsaref_vec.obj sys$input: | ||
41 | ; | ||
42 | ; Transfer vector for VAX shareable image | ||
43 | ; | ||
44 | .TITLE librsaref | ||
45 | ; | ||
46 | ; Define macro to assist in building transfer vector entries. Each entry | ||
47 | ; should take no more than 8 bytes. | ||
48 | ; | ||
49 | .MACRO FTRANSFER_ENTRY routine | ||
50 | .ALIGN QUAD | ||
51 | .TRANSFER routine | ||
52 | .MASK routine | ||
53 | JMP routine+2 | ||
54 | .ENDM FTRANSFER_ENTRY | ||
55 | ; | ||
56 | ; Place entries in own program section. | ||
57 | ; | ||
58 | .PSECT $$LIBRSAREF,QUAD,PIC,USR,CON,REL,LCL,SHR,EXE,RD,NOWRT | ||
59 | |||
60 | LIBRSAREF_xfer: | ||
61 | FTRANSFER_ENTRY bind_engine | ||
62 | FTRANSFER_ENTRY v_check | ||
63 | |||
64 | ; | ||
65 | ; Allocate extra storage at end of vector to allow for expansion. | ||
66 | ; | ||
67 | .BLKB 512-<.-LIBRSAREF_xfer> ; 1 page. | ||
68 | .END | ||
69 | $ link/share=librsaref.exe sys$input:/option | ||
70 | ! | ||
71 | ! Ensure transfer vector is at beginning of image | ||
72 | ! | ||
73 | CLUSTER=FIRST | ||
74 | COLLECT=FIRST,$$LIBRSAREF | ||
75 | ! | ||
76 | ! make psects nonshareable so image can be installed. | ||
77 | ! | ||
78 | PSECT_ATTR=$CHAR_STRING_CONSTANTS,NOWRT | ||
79 | []rsaref_vec.obj | ||
80 | []rsaref.obj | ||
81 | [.install]rsaref.olb/lib | ||
82 | [---.vax.exe.crypto]libcrypto.olb/lib | ||
83 | $ endif | ||
84 | $ | ||
85 | $ set default '_save_default' | ||
diff --git a/src/lib/libssl/src/demos/engines/rsaref/rsaref.c b/src/lib/libssl/src/demos/engines/rsaref/rsaref.c new file mode 100644 index 0000000000..e23f64c01e --- /dev/null +++ b/src/lib/libssl/src/demos/engines/rsaref/rsaref.c | |||
@@ -0,0 +1,682 @@ | |||
1 | /* Demo of how to construct your own engine and using it. The basis of this | ||
2 | engine is RSAref, an old reference of the RSA algorithm which can still | ||
3 | be found a little here and there. */ | ||
4 | |||
5 | #include <stdio.h> | ||
6 | #include "./source/global.h" | ||
7 | #include "./source/rsaref.h" | ||
8 | #include "./source/rsa.h" | ||
9 | #include "./source/des.h" | ||
10 | #include <openssl/err.h> | ||
11 | #include <openssl/evp.h> | ||
12 | #include <openssl/bn.h> | ||
13 | #include <openssl/engine.h> | ||
14 | |||
15 | #define RSAREF_LIB_NAME "rsaref engine" | ||
16 | #include "rsaref_err.c" | ||
17 | |||
18 | /***************************************************************************** | ||
19 | *** Function declarations and global variable definitions *** | ||
20 | *****************************************************************************/ | ||
21 | |||
22 | /***************************************************************************** | ||
23 | * Constants used when creating the ENGINE | ||
24 | **/ | ||
25 | static const char *engine_rsaref_id = "rsaref"; | ||
26 | static const char *engine_rsaref_name = "RSAref engine support"; | ||
27 | |||
28 | /***************************************************************************** | ||
29 | * Functions to handle the engine | ||
30 | **/ | ||
31 | static int rsaref_destroy(ENGINE *e); | ||
32 | static int rsaref_init(ENGINE *e); | ||
33 | static int rsaref_finish(ENGINE *e); | ||
34 | #if 0 | ||
35 | static int rsaref_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)()); | ||
36 | #endif | ||
37 | |||
38 | /***************************************************************************** | ||
39 | * Engine commands | ||
40 | **/ | ||
41 | static const ENGINE_CMD_DEFN rsaref_cmd_defns[] = { | ||
42 | {0, NULL, NULL, 0} | ||
43 | }; | ||
44 | |||
45 | /***************************************************************************** | ||
46 | * RSA functions | ||
47 | **/ | ||
48 | static int rsaref_private_decrypt(int len, const unsigned char *from, | ||
49 | unsigned char *to, RSA *rsa, int padding); | ||
50 | static int rsaref_private_encrypt(int len, const unsigned char *from, | ||
51 | unsigned char *to, RSA *rsa, int padding); | ||
52 | static int rsaref_public_encrypt(int len, const unsigned char *from, | ||
53 | unsigned char *to, RSA *rsa, int padding); | ||
54 | static int rsaref_public_decrypt(int len, const unsigned char *from, | ||
55 | unsigned char *to, RSA *rsa, int padding); | ||
56 | static int bnref_mod_exp(BIGNUM *r,const BIGNUM *a,const BIGNUM *p,const BIGNUM *m, | ||
57 | BN_CTX *ctx, BN_MONT_CTX *m_ctx); | ||
58 | static int rsaref_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa); | ||
59 | |||
60 | /***************************************************************************** | ||
61 | * Our RSA method | ||
62 | **/ | ||
63 | static RSA_METHOD rsaref_rsa = | ||
64 | { | ||
65 | "RSAref PKCS#1 RSA", | ||
66 | rsaref_public_encrypt, | ||
67 | rsaref_public_decrypt, | ||
68 | rsaref_private_encrypt, | ||
69 | rsaref_private_decrypt, | ||
70 | rsaref_mod_exp, | ||
71 | bnref_mod_exp, | ||
72 | NULL, | ||
73 | NULL, | ||
74 | 0, | ||
75 | NULL, | ||
76 | NULL, | ||
77 | NULL | ||
78 | }; | ||
79 | |||
80 | /***************************************************************************** | ||
81 | * Symetric cipher and digest function registrars | ||
82 | **/ | ||
83 | static int rsaref_ciphers(ENGINE *e, const EVP_CIPHER **cipher, | ||
84 | const int **nids, int nid); | ||
85 | static int rsaref_digests(ENGINE *e, const EVP_MD **digest, | ||
86 | const int **nids, int nid); | ||
87 | |||
88 | static int rsaref_cipher_nids[] = | ||
89 | { NID_des_cbc, NID_des_ede3_cbc, NID_desx_cbc, 0 }; | ||
90 | static int rsaref_digest_nids[] = | ||
91 | { NID_md2, NID_md5, 0 }; | ||
92 | |||
93 | /***************************************************************************** | ||
94 | * DES functions | ||
95 | **/ | ||
96 | int cipher_des_cbc_init(EVP_CIPHER_CTX *ctx, const unsigned char *key, | ||
97 | const unsigned char *iv, int enc); | ||
98 | int cipher_des_cbc_code(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
99 | const unsigned char *in, unsigned int inl); | ||
100 | int cipher_des_cbc_clean(EVP_CIPHER_CTX *); | ||
101 | int cipher_des_ede3_cbc_init(EVP_CIPHER_CTX *ctx, const unsigned char *key, | ||
102 | const unsigned char *iv, int enc); | ||
103 | int cipher_des_ede3_cbc_code(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
104 | const unsigned char *in, unsigned int inl); | ||
105 | int cipher_des_ede3_cbc_clean(EVP_CIPHER_CTX *); | ||
106 | int cipher_desx_cbc_init(EVP_CIPHER_CTX *ctx, const unsigned char *key, | ||
107 | const unsigned char *iv, int enc); | ||
108 | int cipher_desx_cbc_code(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
109 | const unsigned char *in, unsigned int inl); | ||
110 | int cipher_desx_cbc_clean(EVP_CIPHER_CTX *); | ||
111 | |||
112 | /***************************************************************************** | ||
113 | * Our DES ciphers | ||
114 | **/ | ||
115 | static const EVP_CIPHER cipher_des_cbc = | ||
116 | { | ||
117 | NID_des_cbc, | ||
118 | 8, 8, 8, | ||
119 | 0, | ||
120 | cipher_des_cbc_init, | ||
121 | cipher_des_cbc_code, | ||
122 | cipher_des_cbc_clean, | ||
123 | sizeof(DES_CBC_CTX), | ||
124 | NULL, | ||
125 | NULL, | ||
126 | NULL, | ||
127 | NULL | ||
128 | }; | ||
129 | |||
130 | static const EVP_CIPHER cipher_des_ede3_cbc = | ||
131 | { | ||
132 | NID_des_ede3_cbc, | ||
133 | 8, 24, 8, | ||
134 | 0, | ||
135 | cipher_des_ede3_cbc_init, | ||
136 | cipher_des_ede3_cbc_code, | ||
137 | cipher_des_ede3_cbc_clean, | ||
138 | sizeof(DES3_CBC_CTX), | ||
139 | NULL, | ||
140 | NULL, | ||
141 | NULL, | ||
142 | NULL | ||
143 | }; | ||
144 | |||
145 | static const EVP_CIPHER cipher_desx_cbc = | ||
146 | { | ||
147 | NID_desx_cbc, | ||
148 | 8, 24, 8, | ||
149 | 0, | ||
150 | cipher_desx_cbc_init, | ||
151 | cipher_desx_cbc_code, | ||
152 | cipher_desx_cbc_clean, | ||
153 | sizeof(DESX_CBC_CTX), | ||
154 | NULL, | ||
155 | NULL, | ||
156 | NULL, | ||
157 | NULL | ||
158 | }; | ||
159 | |||
160 | /***************************************************************************** | ||
161 | * MD functions | ||
162 | **/ | ||
163 | static int digest_md2_init(EVP_MD_CTX *ctx); | ||
164 | static int digest_md2_update(EVP_MD_CTX *ctx,const void *data, | ||
165 | unsigned long count); | ||
166 | static int digest_md2_final(EVP_MD_CTX *ctx,unsigned char *md); | ||
167 | static int digest_md5_init(EVP_MD_CTX *ctx); | ||
168 | static int digest_md5_update(EVP_MD_CTX *ctx,const void *data, | ||
169 | unsigned long count); | ||
170 | static int digest_md5_final(EVP_MD_CTX *ctx,unsigned char *md); | ||
171 | |||
172 | /***************************************************************************** | ||
173 | * Our MD digests | ||
174 | **/ | ||
175 | static const EVP_MD digest_md2 = | ||
176 | { | ||
177 | NID_md2, | ||
178 | NID_md2WithRSAEncryption, | ||
179 | 16, | ||
180 | 0, | ||
181 | digest_md2_init, | ||
182 | digest_md2_update, | ||
183 | digest_md2_final, | ||
184 | NULL, | ||
185 | NULL, | ||
186 | EVP_PKEY_RSA_method, | ||
187 | 16, | ||
188 | sizeof(MD2_CTX) | ||
189 | }; | ||
190 | |||
191 | static const EVP_MD digest_md5 = | ||
192 | { | ||
193 | NID_md5, | ||
194 | NID_md5WithRSAEncryption, | ||
195 | 16, | ||
196 | 0, | ||
197 | digest_md5_init, | ||
198 | digest_md5_update, | ||
199 | digest_md5_final, | ||
200 | NULL, | ||
201 | NULL, | ||
202 | EVP_PKEY_RSA_method, | ||
203 | 64, | ||
204 | sizeof(MD5_CTX) | ||
205 | }; | ||
206 | |||
207 | /***************************************************************************** | ||
208 | *** Function definitions *** | ||
209 | *****************************************************************************/ | ||
210 | |||
211 | /***************************************************************************** | ||
212 | * Functions to handle the engine | ||
213 | **/ | ||
214 | |||
215 | static int bind_rsaref(ENGINE *e) | ||
216 | { | ||
217 | const RSA_METHOD *meth1; | ||
218 | if(!ENGINE_set_id(e, engine_rsaref_id) | ||
219 | || !ENGINE_set_name(e, engine_rsaref_name) | ||
220 | || !ENGINE_set_RSA(e, &rsaref_rsa) | ||
221 | || !ENGINE_set_ciphers(e, rsaref_ciphers) | ||
222 | || !ENGINE_set_digests(e, rsaref_digests) | ||
223 | || !ENGINE_set_destroy_function(e, rsaref_destroy) | ||
224 | || !ENGINE_set_init_function(e, rsaref_init) | ||
225 | || !ENGINE_set_finish_function(e, rsaref_finish) | ||
226 | /* || !ENGINE_set_ctrl_function(e, rsaref_ctrl) */ | ||
227 | /* || !ENGINE_set_cmd_defns(e, rsaref_cmd_defns) */) | ||
228 | return 0; | ||
229 | |||
230 | /* Ensure the rsaref error handling is set up */ | ||
231 | ERR_load_RSAREF_strings(); | ||
232 | return 1; | ||
233 | } | ||
234 | |||
235 | #ifdef ENGINE_DYNAMIC_SUPPORT | ||
236 | static int bind_helper(ENGINE *e, const char *id) | ||
237 | { | ||
238 | if(id && (strcmp(id, engine_rsaref_id) != 0)) | ||
239 | return 0; | ||
240 | if(!bind_rsaref(e)) | ||
241 | return 0; | ||
242 | return 1; | ||
243 | } | ||
244 | IMPLEMENT_DYNAMIC_CHECK_FN() | ||
245 | IMPLEMENT_DYNAMIC_BIND_FN(bind_helper) | ||
246 | #else | ||
247 | static ENGINE *engine_rsaref(void) | ||
248 | { | ||
249 | ENGINE *ret = ENGINE_new(); | ||
250 | if(!ret) | ||
251 | return NULL; | ||
252 | if(!bind_rsaref(ret)) | ||
253 | { | ||
254 | ENGINE_free(ret); | ||
255 | return NULL; | ||
256 | } | ||
257 | return ret; | ||
258 | } | ||
259 | |||
260 | void ENGINE_load_rsaref(void) | ||
261 | { | ||
262 | /* Copied from eng_[openssl|dyn].c */ | ||
263 | ENGINE *toadd = engine_rsaref(); | ||
264 | if(!toadd) return; | ||
265 | ENGINE_add(toadd); | ||
266 | ENGINE_free(toadd); | ||
267 | ERR_clear_error(); | ||
268 | } | ||
269 | #endif | ||
270 | |||
271 | /* Initiator which is only present to make sure this engine looks available */ | ||
272 | static int rsaref_init(ENGINE *e) | ||
273 | { | ||
274 | return 1; | ||
275 | } | ||
276 | |||
277 | /* Finisher which is only present to make sure this engine looks available */ | ||
278 | static int rsaref_finish(ENGINE *e) | ||
279 | { | ||
280 | return 1; | ||
281 | } | ||
282 | |||
283 | /* Destructor (complements the "ENGINE_ncipher()" constructor) */ | ||
284 | static int rsaref_destroy(ENGINE *e) | ||
285 | { | ||
286 | ERR_unload_RSAREF_strings(); | ||
287 | return 1; | ||
288 | } | ||
289 | |||
290 | /***************************************************************************** | ||
291 | * RSA functions | ||
292 | **/ | ||
293 | |||
294 | static int rsaref_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa) | ||
295 | { | ||
296 | RSAREFerr(RSAREF_F_RSAREF_MOD_EXP,ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); | ||
297 | return(0); | ||
298 | } | ||
299 | |||
300 | static int bnref_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, | ||
301 | const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx) | ||
302 | { | ||
303 | RSAREFerr(RSAREF_F_BNREF_MOD_EXP,ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); | ||
304 | return(0); | ||
305 | } | ||
306 | |||
307 | /* unsigned char *to: [max] */ | ||
308 | static int RSAref_bn2bin(BIGNUM *from, unsigned char *to, int max) | ||
309 | { | ||
310 | int i; | ||
311 | |||
312 | i=BN_num_bytes(from); | ||
313 | if (i > max) | ||
314 | { | ||
315 | RSAREFerr(RSAREF_F_RSAREF_BN2BIN,RSAREF_R_LEN); | ||
316 | return(0); | ||
317 | } | ||
318 | |||
319 | memset(to,0,(unsigned int)max); | ||
320 | if (!BN_bn2bin(from,&(to[max-i]))) | ||
321 | return(0); | ||
322 | return(1); | ||
323 | } | ||
324 | |||
325 | #ifdef undef | ||
326 | /* unsigned char *from: [max] */ | ||
327 | static BIGNUM *RSAref_bin2bn(unsigned char *from, BIGNUM *to, int max) | ||
328 | { | ||
329 | int i; | ||
330 | BIGNUM *ret; | ||
331 | |||
332 | for (i=0; i<max; i++) | ||
333 | if (from[i]) break; | ||
334 | |||
335 | ret=BN_bin2bn(&(from[i]),max-i,to); | ||
336 | return(ret); | ||
337 | } | ||
338 | |||
339 | static int RSAref_Public_ref2eay(RSArefPublicKey *from, RSA *to) | ||
340 | { | ||
341 | to->n=RSAref_bin2bn(from->m,NULL,RSAref_MAX_LEN); | ||
342 | to->e=RSAref_bin2bn(from->e,NULL,RSAref_MAX_LEN); | ||
343 | if ((to->n == NULL) || (to->e == NULL)) return(0); | ||
344 | return(1); | ||
345 | } | ||
346 | #endif | ||
347 | |||
348 | static int RSAref_Public_eay2ref(RSA *from, R_RSA_PUBLIC_KEY *to) | ||
349 | { | ||
350 | to->bits=BN_num_bits(from->n); | ||
351 | if (!RSAref_bn2bin(from->n,to->modulus,MAX_RSA_MODULUS_LEN)) return(0); | ||
352 | if (!RSAref_bn2bin(from->e,to->exponent,MAX_RSA_MODULUS_LEN)) return(0); | ||
353 | return(1); | ||
354 | } | ||
355 | |||
356 | #ifdef undef | ||
357 | static int RSAref_Private_ref2eay(RSArefPrivateKey *from, RSA *to) | ||
358 | { | ||
359 | if ((to->n=RSAref_bin2bn(from->m,NULL,RSAref_MAX_LEN)) == NULL) | ||
360 | return(0); | ||
361 | if ((to->e=RSAref_bin2bn(from->e,NULL,RSAref_MAX_LEN)) == NULL) | ||
362 | return(0); | ||
363 | if ((to->d=RSAref_bin2bn(from->d,NULL,RSAref_MAX_LEN)) == NULL) | ||
364 | return(0); | ||
365 | if ((to->p=RSAref_bin2bn(from->prime[0],NULL,RSAref_MAX_PLEN)) == NULL) | ||
366 | return(0); | ||
367 | if ((to->q=RSAref_bin2bn(from->prime[1],NULL,RSAref_MAX_PLEN)) == NULL) | ||
368 | return(0); | ||
369 | if ((to->dmp1=RSAref_bin2bn(from->pexp[0],NULL,RSAref_MAX_PLEN)) | ||
370 | == NULL) | ||
371 | return(0); | ||
372 | if ((to->dmq1=RSAref_bin2bn(from->pexp[1],NULL,RSAref_MAX_PLEN)) | ||
373 | == NULL) | ||
374 | return(0); | ||
375 | if ((to->iqmp=RSAref_bin2bn(from->coef,NULL,RSAref_MAX_PLEN)) == NULL) | ||
376 | return(0); | ||
377 | return(1); | ||
378 | } | ||
379 | #endif | ||
380 | |||
381 | static int RSAref_Private_eay2ref(RSA *from, R_RSA_PRIVATE_KEY *to) | ||
382 | { | ||
383 | to->bits=BN_num_bits(from->n); | ||
384 | if (!RSAref_bn2bin(from->n,to->modulus,MAX_RSA_MODULUS_LEN)) return(0); | ||
385 | if (!RSAref_bn2bin(from->e,to->publicExponent,MAX_RSA_MODULUS_LEN)) return(0); | ||
386 | if (!RSAref_bn2bin(from->d,to->exponent,MAX_RSA_MODULUS_LEN)) return(0); | ||
387 | if (!RSAref_bn2bin(from->p,to->prime[0],MAX_RSA_PRIME_LEN)) return(0); | ||
388 | if (!RSAref_bn2bin(from->q,to->prime[1],MAX_RSA_PRIME_LEN)) return(0); | ||
389 | if (!RSAref_bn2bin(from->dmp1,to->primeExponent[0],MAX_RSA_PRIME_LEN)) return(0); | ||
390 | if (!RSAref_bn2bin(from->dmq1,to->primeExponent[1],MAX_RSA_PRIME_LEN)) return(0); | ||
391 | if (!RSAref_bn2bin(from->iqmp,to->coefficient,MAX_RSA_PRIME_LEN)) return(0); | ||
392 | return(1); | ||
393 | } | ||
394 | |||
395 | static int rsaref_private_decrypt(int len, const unsigned char *from, unsigned char *to, | ||
396 | RSA *rsa, int padding) | ||
397 | { | ||
398 | int i,outlen= -1; | ||
399 | R_RSA_PRIVATE_KEY RSAkey; | ||
400 | |||
401 | if (!RSAref_Private_eay2ref(rsa,&RSAkey)) | ||
402 | goto err; | ||
403 | if ((i=RSAPrivateDecrypt(to,&outlen,(unsigned char *)from,len,&RSAkey)) != 0) | ||
404 | { | ||
405 | RSAREFerr(RSAREF_F_RSAREF_PRIVATE_DECRYPT,i); | ||
406 | outlen= -1; | ||
407 | } | ||
408 | err: | ||
409 | memset(&RSAkey,0,sizeof(RSAkey)); | ||
410 | return(outlen); | ||
411 | } | ||
412 | |||
413 | static int rsaref_private_encrypt(int len, const unsigned char *from, unsigned char *to, | ||
414 | RSA *rsa, int padding) | ||
415 | { | ||
416 | int i,outlen= -1; | ||
417 | R_RSA_PRIVATE_KEY RSAkey; | ||
418 | |||
419 | if (padding != RSA_PKCS1_PADDING) | ||
420 | { | ||
421 | RSAREFerr(RSAREF_F_RSAREF_PRIVATE_ENCRYPT, RSA_R_UNKNOWN_PADDING_TYPE); | ||
422 | goto err; | ||
423 | } | ||
424 | if (!RSAref_Private_eay2ref(rsa,&RSAkey)) | ||
425 | goto err; | ||
426 | if ((i=RSAPrivateEncrypt(to,&outlen,(unsigned char *)from,len,&RSAkey)) != 0) | ||
427 | { | ||
428 | RSAREFerr(RSAREF_F_RSAREF_PRIVATE_ENCRYPT,i); | ||
429 | outlen= -1; | ||
430 | } | ||
431 | err: | ||
432 | memset(&RSAkey,0,sizeof(RSAkey)); | ||
433 | return(outlen); | ||
434 | } | ||
435 | |||
436 | static int rsaref_public_decrypt(int len, const unsigned char *from, unsigned char *to, | ||
437 | RSA *rsa, int padding) | ||
438 | { | ||
439 | int i,outlen= -1; | ||
440 | R_RSA_PUBLIC_KEY RSAkey; | ||
441 | |||
442 | if (!RSAref_Public_eay2ref(rsa,&RSAkey)) | ||
443 | goto err; | ||
444 | if ((i=RSAPublicDecrypt(to,&outlen,(unsigned char *)from,len,&RSAkey)) != 0) | ||
445 | { | ||
446 | RSAREFerr(RSAREF_F_RSAREF_PUBLIC_DECRYPT,i); | ||
447 | outlen= -1; | ||
448 | } | ||
449 | err: | ||
450 | memset(&RSAkey,0,sizeof(RSAkey)); | ||
451 | return(outlen); | ||
452 | } | ||
453 | |||
454 | static int rsaref_public_encrypt(int len, const unsigned char *from, unsigned char *to, | ||
455 | RSA *rsa, int padding) | ||
456 | { | ||
457 | int outlen= -1; | ||
458 | int i; | ||
459 | R_RSA_PUBLIC_KEY RSAkey; | ||
460 | R_RANDOM_STRUCT rnd; | ||
461 | unsigned char buf[16]; | ||
462 | |||
463 | if (padding != RSA_PKCS1_PADDING && padding != RSA_SSLV23_PADDING) | ||
464 | { | ||
465 | RSAREFerr(RSAREF_F_RSAREF_PUBLIC_ENCRYPT, RSA_R_UNKNOWN_PADDING_TYPE); | ||
466 | goto err; | ||
467 | } | ||
468 | |||
469 | R_RandomInit(&rnd); | ||
470 | R_GetRandomBytesNeeded((unsigned int *)&i,&rnd); | ||
471 | while (i > 0) | ||
472 | { | ||
473 | if (RAND_bytes(buf,16) <= 0) | ||
474 | goto err; | ||
475 | R_RandomUpdate(&rnd,buf,(unsigned int)((i>16)?16:i)); | ||
476 | i-=16; | ||
477 | } | ||
478 | |||
479 | if (!RSAref_Public_eay2ref(rsa,&RSAkey)) | ||
480 | goto err; | ||
481 | if ((i=RSAPublicEncrypt(to,&outlen,(unsigned char *)from,len,&RSAkey,&rnd)) != 0) | ||
482 | { | ||
483 | RSAREFerr(RSAREF_F_RSAREF_PUBLIC_ENCRYPT,i); | ||
484 | outlen= -1; | ||
485 | goto err; | ||
486 | } | ||
487 | err: | ||
488 | memset(&RSAkey,0,sizeof(RSAkey)); | ||
489 | R_RandomFinal(&rnd); | ||
490 | memset(&rnd,0,sizeof(rnd)); | ||
491 | return(outlen); | ||
492 | } | ||
493 | |||
494 | /***************************************************************************** | ||
495 | * Symetric cipher and digest function registrars | ||
496 | **/ | ||
497 | static int rsaref_ciphers(ENGINE *e, const EVP_CIPHER **cipher, | ||
498 | const int **nids, int nid) | ||
499 | { | ||
500 | int ok = 1; | ||
501 | if(!cipher) | ||
502 | { | ||
503 | /* We are returning a list of supported nids */ | ||
504 | *nids = rsaref_cipher_nids; | ||
505 | return (sizeof(rsaref_cipher_nids)-1)/sizeof(rsaref_cipher_nids[0]); | ||
506 | } | ||
507 | /* We are being asked for a specific cipher */ | ||
508 | switch (nid) | ||
509 | { | ||
510 | case NID_des_cbc: | ||
511 | *cipher = &cipher_des_cbc; break; | ||
512 | case NID_des_ede3_cbc: | ||
513 | *cipher = &cipher_des_ede3_cbc; break; | ||
514 | case NID_desx_cbc: | ||
515 | *cipher = &cipher_desx_cbc; break; | ||
516 | default: | ||
517 | ok = 0; | ||
518 | *cipher = NULL; | ||
519 | break; | ||
520 | } | ||
521 | return ok; | ||
522 | } | ||
523 | static int rsaref_digests(ENGINE *e, const EVP_MD **digest, | ||
524 | const int **nids, int nid) | ||
525 | { | ||
526 | int ok = 1; | ||
527 | if(!digest) | ||
528 | { | ||
529 | /* We are returning a list of supported nids */ | ||
530 | *nids = rsaref_digest_nids; | ||
531 | return (sizeof(rsaref_digest_nids)-1)/sizeof(rsaref_digest_nids[0]); | ||
532 | } | ||
533 | /* We are being asked for a specific digest */ | ||
534 | switch (nid) | ||
535 | { | ||
536 | case NID_md2: | ||
537 | *digest = &digest_md2; break; | ||
538 | case NID_md5: | ||
539 | *digest = &digest_md5; break; | ||
540 | default: | ||
541 | ok = 0; | ||
542 | *digest = NULL; | ||
543 | break; | ||
544 | } | ||
545 | return ok; | ||
546 | } | ||
547 | |||
548 | /***************************************************************************** | ||
549 | * DES functions | ||
550 | **/ | ||
551 | #undef data | ||
552 | #define data(ctx) ((DES_CBC_CTX *)(ctx)->cipher_data) | ||
553 | int cipher_des_cbc_init(EVP_CIPHER_CTX *ctx, const unsigned char *key, | ||
554 | const unsigned char *iv, int enc) | ||
555 | { | ||
556 | DES_CBCInit(data(ctx), (unsigned char *)key, (unsigned char *)iv, enc); | ||
557 | return 1; | ||
558 | } | ||
559 | int cipher_des_cbc_code(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
560 | const unsigned char *in, unsigned int inl) | ||
561 | { | ||
562 | int ret = DES_CBCUpdate(data(ctx), out, (unsigned char *)in, inl); | ||
563 | switch (ret) | ||
564 | { | ||
565 | case RE_LEN: | ||
566 | RSAREFerr(RSAREF_F_CIPHER_DES_CBC_CODE,RSAREF_R_LENGTH_NOT_BLOCK_ALIGNED); | ||
567 | break; | ||
568 | case 0: | ||
569 | break; | ||
570 | default: | ||
571 | RSAREFerr(RSAREF_F_CIPHER_DES_CBC_CODE,RSAREF_R_UNKNOWN_FAULT); | ||
572 | } | ||
573 | return !ret; | ||
574 | } | ||
575 | int cipher_des_cbc_clean(EVP_CIPHER_CTX *ctx) | ||
576 | { | ||
577 | memset(data(ctx), 0, ctx->cipher->ctx_size); | ||
578 | return 1; | ||
579 | } | ||
580 | |||
581 | #undef data | ||
582 | #define data(ctx) ((DES3_CBC_CTX *)(ctx)->cipher_data) | ||
583 | int cipher_des_ede3_cbc_init(EVP_CIPHER_CTX *ctx, const unsigned char *key, | ||
584 | const unsigned char *iv, int enc) | ||
585 | { | ||
586 | DES3_CBCInit(data(ctx), (unsigned char *)key, (unsigned char *)iv, | ||
587 | enc); | ||
588 | return 1; | ||
589 | } | ||
590 | int cipher_des_ede3_cbc_code(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
591 | const unsigned char *in, unsigned int inl) | ||
592 | { | ||
593 | int ret = DES3_CBCUpdate(data(ctx), out, (unsigned char *)in, inl); | ||
594 | switch (ret) | ||
595 | { | ||
596 | case RE_LEN: | ||
597 | RSAREFerr(RSAREF_F_CIPHER_DES_CBC_CODE,RSAREF_R_LENGTH_NOT_BLOCK_ALIGNED); | ||
598 | break; | ||
599 | case 0: | ||
600 | break; | ||
601 | default: | ||
602 | RSAREFerr(RSAREF_F_CIPHER_DES_CBC_CODE,RSAREF_R_UNKNOWN_FAULT); | ||
603 | } | ||
604 | return !ret; | ||
605 | } | ||
606 | int cipher_des_ede3_cbc_clean(EVP_CIPHER_CTX *ctx) | ||
607 | { | ||
608 | memset(data(ctx), 0, ctx->cipher->ctx_size); | ||
609 | return 1; | ||
610 | } | ||
611 | |||
612 | #undef data | ||
613 | #define data(ctx) ((DESX_CBC_CTX *)(ctx)->cipher_data) | ||
614 | int cipher_desx_cbc_init(EVP_CIPHER_CTX *ctx, const unsigned char *key, | ||
615 | const unsigned char *iv, int enc) | ||
616 | { | ||
617 | DESX_CBCInit(data(ctx), (unsigned char *)key, (unsigned char *)iv, | ||
618 | enc); | ||
619 | return 1; | ||
620 | } | ||
621 | int cipher_desx_cbc_code(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
622 | const unsigned char *in, unsigned int inl) | ||
623 | { | ||
624 | int ret = DESX_CBCUpdate(data(ctx), out, (unsigned char *)in, inl); | ||
625 | switch (ret) | ||
626 | { | ||
627 | case RE_LEN: | ||
628 | RSAREFerr(RSAREF_F_CIPHER_DES_CBC_CODE,RSAREF_R_LENGTH_NOT_BLOCK_ALIGNED); | ||
629 | break; | ||
630 | case 0: | ||
631 | break; | ||
632 | default: | ||
633 | RSAREFerr(RSAREF_F_CIPHER_DES_CBC_CODE,RSAREF_R_UNKNOWN_FAULT); | ||
634 | } | ||
635 | return !ret; | ||
636 | } | ||
637 | int cipher_desx_cbc_clean(EVP_CIPHER_CTX *ctx) | ||
638 | { | ||
639 | memset(data(ctx), 0, ctx->cipher->ctx_size); | ||
640 | return 1; | ||
641 | } | ||
642 | |||
643 | /***************************************************************************** | ||
644 | * MD functions | ||
645 | **/ | ||
646 | #undef data | ||
647 | #define data(ctx) ((MD2_CTX *)(ctx)->md_data) | ||
648 | static int digest_md2_init(EVP_MD_CTX *ctx) | ||
649 | { | ||
650 | MD2Init(data(ctx)); | ||
651 | return 1; | ||
652 | } | ||
653 | static int digest_md2_update(EVP_MD_CTX *ctx,const void *data, | ||
654 | unsigned long count) | ||
655 | { | ||
656 | MD2Update(data(ctx), (unsigned char *)data, (unsigned int)count); | ||
657 | return 1; | ||
658 | } | ||
659 | static int digest_md2_final(EVP_MD_CTX *ctx,unsigned char *md) | ||
660 | { | ||
661 | MD2Final(md, data(ctx)); | ||
662 | return 1; | ||
663 | } | ||
664 | |||
665 | #undef data | ||
666 | #define data(ctx) ((MD5_CTX *)(ctx)->md_data) | ||
667 | static int digest_md5_init(EVP_MD_CTX *ctx) | ||
668 | { | ||
669 | MD5Init(data(ctx)); | ||
670 | return 1; | ||
671 | } | ||
672 | static int digest_md5_update(EVP_MD_CTX *ctx,const void *data, | ||
673 | unsigned long count) | ||
674 | { | ||
675 | MD5Update(data(ctx), (unsigned char *)data, (unsigned int)count); | ||
676 | return 1; | ||
677 | } | ||
678 | static int digest_md5_final(EVP_MD_CTX *ctx,unsigned char *md) | ||
679 | { | ||
680 | MD5Final(md, data(ctx)); | ||
681 | return 1; | ||
682 | } | ||
diff --git a/src/lib/libssl/src/demos/engines/rsaref/rsaref.ec b/src/lib/libssl/src/demos/engines/rsaref/rsaref.ec new file mode 100644 index 0000000000..c690ae3883 --- /dev/null +++ b/src/lib/libssl/src/demos/engines/rsaref/rsaref.ec | |||
@@ -0,0 +1,8 @@ | |||
1 | # configuration file for util/mkerr.pl | ||
2 | # | ||
3 | # use like this: | ||
4 | # | ||
5 | # perl ../../../util/mkerr.pl -conf rsaref.ec \ | ||
6 | # -nostatic -staticloader -write *.c | ||
7 | |||
8 | L RSAREF rsaref_err.h rsaref_err.c | ||
diff --git a/src/lib/libssl/src/demos/engines/rsaref/rsaref_err.c b/src/lib/libssl/src/demos/engines/rsaref/rsaref_err.c new file mode 100644 index 0000000000..ceaf05706d --- /dev/null +++ b/src/lib/libssl/src/demos/engines/rsaref/rsaref_err.c | |||
@@ -0,0 +1,161 @@ | |||
1 | /* rsaref_err.c */ | ||
2 | /* ==================================================================== | ||
3 | * Copyright (c) 1999 The OpenSSL Project. All rights reserved. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions | ||
7 | * are met: | ||
8 | * | ||
9 | * 1. Redistributions of source code must retain the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer. | ||
11 | * | ||
12 | * 2. Redistributions in binary form must reproduce the above copyright | ||
13 | * notice, this list of conditions and the following disclaimer in | ||
14 | * the documentation and/or other materials provided with the | ||
15 | * distribution. | ||
16 | * | ||
17 | * 3. All advertising materials mentioning features or use of this | ||
18 | * software must display the following acknowledgment: | ||
19 | * "This product includes software developed by the OpenSSL Project | ||
20 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" | ||
21 | * | ||
22 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
23 | * endorse or promote products derived from this software without | ||
24 | * prior written permission. For written permission, please contact | ||
25 | * openssl-core@OpenSSL.org. | ||
26 | * | ||
27 | * 5. Products derived from this software may not be called "OpenSSL" | ||
28 | * nor may "OpenSSL" appear in their names without prior written | ||
29 | * permission of the OpenSSL Project. | ||
30 | * | ||
31 | * 6. Redistributions of any form whatsoever must retain the following | ||
32 | * acknowledgment: | ||
33 | * "This product includes software developed by the OpenSSL Project | ||
34 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" | ||
35 | * | ||
36 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
37 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
38 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
39 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
40 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
41 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
42 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
43 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
44 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
45 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
46 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
47 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
48 | * ==================================================================== | ||
49 | * | ||
50 | * This product includes cryptographic software written by Eric Young | ||
51 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
52 | * Hudson (tjh@cryptsoft.com). | ||
53 | * | ||
54 | */ | ||
55 | |||
56 | /* NOTE: this file was auto generated by the mkerr.pl script: any changes | ||
57 | * made to it will be overwritten when the script next updates this file, | ||
58 | * only reason strings will be preserved. | ||
59 | */ | ||
60 | |||
61 | #include <stdio.h> | ||
62 | #include <openssl/err.h> | ||
63 | #include "rsaref_err.h" | ||
64 | |||
65 | /* BEGIN ERROR CODES */ | ||
66 | #ifndef OPENSSL_NO_ERR | ||
67 | static ERR_STRING_DATA RSAREF_str_functs[]= | ||
68 | { | ||
69 | {ERR_PACK(0,RSAREF_F_BNREF_MOD_EXP,0), "BNREF_MOD_EXP"}, | ||
70 | {ERR_PACK(0,RSAREF_F_CIPHER_DES_CBC_CODE,0), "CIPHER_DES_CBC_CODE"}, | ||
71 | {ERR_PACK(0,RSAREF_F_RSAREF_BN2BIN,0), "RSAREF_BN2BIN"}, | ||
72 | {ERR_PACK(0,RSAREF_F_RSAREF_MOD_EXP,0), "RSAREF_MOD_EXP"}, | ||
73 | {ERR_PACK(0,RSAREF_F_RSAREF_PRIVATE_DECRYPT,0), "RSAREF_PRIVATE_DECRYPT"}, | ||
74 | {ERR_PACK(0,RSAREF_F_RSAREF_PRIVATE_ENCRYPT,0), "RSAREF_PRIVATE_ENCRYPT"}, | ||
75 | {ERR_PACK(0,RSAREF_F_RSAREF_PUBLIC_DECRYPT,0), "RSAREF_PUBLIC_DECRYPT"}, | ||
76 | {ERR_PACK(0,RSAREF_F_RSAREF_PUBLIC_ENCRYPT,0), "RSAREF_PUBLIC_ENCRYPT"}, | ||
77 | {ERR_PACK(0,RSAREF_F_RSA_BN2BIN,0), "RSA_BN2BIN"}, | ||
78 | {ERR_PACK(0,RSAREF_F_RSA_PRIVATE_DECRYPT,0), "RSA_PRIVATE_DECRYPT"}, | ||
79 | {ERR_PACK(0,RSAREF_F_RSA_PRIVATE_ENCRYPT,0), "RSA_PRIVATE_ENCRYPT"}, | ||
80 | {ERR_PACK(0,RSAREF_F_RSA_PUBLIC_DECRYPT,0), "RSA_PUBLIC_DECRYPT"}, | ||
81 | {ERR_PACK(0,RSAREF_F_RSA_PUBLIC_ENCRYPT,0), "RSA_PUBLIC_ENCRYPT"}, | ||
82 | {0,NULL} | ||
83 | }; | ||
84 | |||
85 | static ERR_STRING_DATA RSAREF_str_reasons[]= | ||
86 | { | ||
87 | {RSAREF_R_CONTENT_ENCODING ,"content encoding"}, | ||
88 | {RSAREF_R_DATA ,"data"}, | ||
89 | {RSAREF_R_DIGEST_ALGORITHM ,"digest algorithm"}, | ||
90 | {RSAREF_R_ENCODING ,"encoding"}, | ||
91 | {RSAREF_R_ENCRYPTION_ALGORITHM ,"encryption algorithm"}, | ||
92 | {RSAREF_R_KEY ,"key"}, | ||
93 | {RSAREF_R_KEY_ENCODING ,"key encoding"}, | ||
94 | {RSAREF_R_LEN ,"len"}, | ||
95 | {RSAREF_R_LENGTH_NOT_BLOCK_ALIGNED ,"length not block aligned"}, | ||
96 | {RSAREF_R_MODULUS_LEN ,"modulus len"}, | ||
97 | {RSAREF_R_NEED_RANDOM ,"need random"}, | ||
98 | {RSAREF_R_PRIVATE_KEY ,"private key"}, | ||
99 | {RSAREF_R_PUBLIC_KEY ,"public key"}, | ||
100 | {RSAREF_R_SIGNATURE ,"signature"}, | ||
101 | {RSAREF_R_SIGNATURE_ENCODING ,"signature encoding"}, | ||
102 | {RSAREF_R_UNKNOWN_FAULT ,"unknown fault"}, | ||
103 | {0,NULL} | ||
104 | }; | ||
105 | |||
106 | #endif | ||
107 | |||
108 | #ifdef RSAREF_LIB_NAME | ||
109 | static ERR_STRING_DATA RSAREF_lib_name[]= | ||
110 | { | ||
111 | {0 ,RSAREF_LIB_NAME}, | ||
112 | {0,NULL} | ||
113 | }; | ||
114 | #endif | ||
115 | |||
116 | |||
117 | static int RSAREF_lib_error_code=0; | ||
118 | static int RSAREF_error_init=1; | ||
119 | |||
120 | static void ERR_load_RSAREF_strings(void) | ||
121 | { | ||
122 | if (RSAREF_lib_error_code == 0) | ||
123 | RSAREF_lib_error_code=ERR_get_next_error_library(); | ||
124 | |||
125 | if (RSAREF_error_init) | ||
126 | { | ||
127 | RSAREF_error_init=0; | ||
128 | #ifndef OPENSSL_NO_ERR | ||
129 | ERR_load_strings(RSAREF_lib_error_code,RSAREF_str_functs); | ||
130 | ERR_load_strings(RSAREF_lib_error_code,RSAREF_str_reasons); | ||
131 | #endif | ||
132 | |||
133 | #ifdef RSAREF_LIB_NAME | ||
134 | RSAREF_lib_name->error = ERR_PACK(RSAREF_lib_error_code,0,0); | ||
135 | ERR_load_strings(0,RSAREF_lib_name); | ||
136 | #endif | ||
137 | } | ||
138 | } | ||
139 | |||
140 | static void ERR_unload_RSAREF_strings(void) | ||
141 | { | ||
142 | if (RSAREF_error_init == 0) | ||
143 | { | ||
144 | #ifndef OPENSSL_NO_ERR | ||
145 | ERR_unload_strings(RSAREF_lib_error_code,RSAREF_str_functs); | ||
146 | ERR_unload_strings(RSAREF_lib_error_code,RSAREF_str_reasons); | ||
147 | #endif | ||
148 | |||
149 | #ifdef RSAREF_LIB_NAME | ||
150 | ERR_unload_strings(0,RSAREF_lib_name); | ||
151 | #endif | ||
152 | RSAREF_error_init=1; | ||
153 | } | ||
154 | } | ||
155 | |||
156 | static void ERR_RSAREF_error(int function, int reason, char *file, int line) | ||
157 | { | ||
158 | if (RSAREF_lib_error_code == 0) | ||
159 | RSAREF_lib_error_code=ERR_get_next_error_library(); | ||
160 | ERR_PUT_error(RSAREF_lib_error_code,function,reason,file,line); | ||
161 | } | ||
diff --git a/src/lib/libssl/src/demos/engines/rsaref/rsaref_err.h b/src/lib/libssl/src/demos/engines/rsaref/rsaref_err.h new file mode 100644 index 0000000000..19759709b7 --- /dev/null +++ b/src/lib/libssl/src/demos/engines/rsaref/rsaref_err.h | |||
@@ -0,0 +1,109 @@ | |||
1 | /* rsaref_err.h */ | ||
2 | /* ==================================================================== | ||
3 | * Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions | ||
7 | * are met: | ||
8 | * | ||
9 | * 1. Redistributions of source code must retain the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer. | ||
11 | * | ||
12 | * 2. Redistributions in binary form must reproduce the above copyright | ||
13 | * notice, this list of conditions and the following disclaimer in | ||
14 | * the documentation and/or other materials provided with the | ||
15 | * distribution. | ||
16 | * | ||
17 | * 3. All advertising materials mentioning features or use of this | ||
18 | * software must display the following acknowledgment: | ||
19 | * "This product includes software developed by the OpenSSL Project | ||
20 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
21 | * | ||
22 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
23 | * endorse or promote products derived from this software without | ||
24 | * prior written permission. For written permission, please contact | ||
25 | * openssl-core@openssl.org. | ||
26 | * | ||
27 | * 5. Products derived from this software may not be called "OpenSSL" | ||
28 | * nor may "OpenSSL" appear in their names without prior written | ||
29 | * permission of the OpenSSL Project. | ||
30 | * | ||
31 | * 6. Redistributions of any form whatsoever must retain the following | ||
32 | * acknowledgment: | ||
33 | * "This product includes software developed by the OpenSSL Project | ||
34 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
35 | * | ||
36 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
37 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
38 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
39 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
40 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
41 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
42 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
43 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
44 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
45 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
46 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
47 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
48 | * ==================================================================== | ||
49 | * | ||
50 | * This product includes cryptographic software written by Eric Young | ||
51 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
52 | * Hudson (tjh@cryptsoft.com). | ||
53 | * | ||
54 | */ | ||
55 | |||
56 | #ifndef HEADER_RSAREF_ERR_H | ||
57 | #define HEADER_RSAREF_ERR_H | ||
58 | |||
59 | #ifdef __cplusplus | ||
60 | extern "C" { | ||
61 | #endif | ||
62 | |||
63 | /* BEGIN ERROR CODES */ | ||
64 | /* The following lines are auto generated by the script mkerr.pl. Any changes | ||
65 | * made after this point may be overwritten when the script is next run. | ||
66 | */ | ||
67 | static void ERR_load_RSAREF_strings(void); | ||
68 | static void ERR_unload_RSAREF_strings(void); | ||
69 | static void ERR_RSAREF_error(int function, int reason, char *file, int line); | ||
70 | #define RSAREFerr(f,r) ERR_RSAREF_error((f),(r),__FILE__,__LINE__) | ||
71 | /* Error codes for the RSAREF functions. */ | ||
72 | |||
73 | /* Function codes. */ | ||
74 | #define RSAREF_F_BNREF_MOD_EXP 100 | ||
75 | #define RSAREF_F_CIPHER_DES_CBC_CODE 112 | ||
76 | #define RSAREF_F_RSAREF_BN2BIN 101 | ||
77 | #define RSAREF_F_RSAREF_MOD_EXP 102 | ||
78 | #define RSAREF_F_RSAREF_PRIVATE_DECRYPT 103 | ||
79 | #define RSAREF_F_RSAREF_PRIVATE_ENCRYPT 104 | ||
80 | #define RSAREF_F_RSAREF_PUBLIC_DECRYPT 105 | ||
81 | #define RSAREF_F_RSAREF_PUBLIC_ENCRYPT 106 | ||
82 | #define RSAREF_F_RSA_BN2BIN 107 | ||
83 | #define RSAREF_F_RSA_PRIVATE_DECRYPT 108 | ||
84 | #define RSAREF_F_RSA_PRIVATE_ENCRYPT 109 | ||
85 | #define RSAREF_F_RSA_PUBLIC_DECRYPT 110 | ||
86 | #define RSAREF_F_RSA_PUBLIC_ENCRYPT 111 | ||
87 | |||
88 | /* Reason codes. */ | ||
89 | #define RSAREF_R_CONTENT_ENCODING 100 | ||
90 | #define RSAREF_R_DATA 101 | ||
91 | #define RSAREF_R_DIGEST_ALGORITHM 102 | ||
92 | #define RSAREF_R_ENCODING 103 | ||
93 | #define RSAREF_R_ENCRYPTION_ALGORITHM 104 | ||
94 | #define RSAREF_R_KEY 105 | ||
95 | #define RSAREF_R_KEY_ENCODING 106 | ||
96 | #define RSAREF_R_LEN 107 | ||
97 | #define RSAREF_R_LENGTH_NOT_BLOCK_ALIGNED 114 | ||
98 | #define RSAREF_R_MODULUS_LEN 108 | ||
99 | #define RSAREF_R_NEED_RANDOM 109 | ||
100 | #define RSAREF_R_PRIVATE_KEY 110 | ||
101 | #define RSAREF_R_PUBLIC_KEY 111 | ||
102 | #define RSAREF_R_SIGNATURE 112 | ||
103 | #define RSAREF_R_SIGNATURE_ENCODING 113 | ||
104 | #define RSAREF_R_UNKNOWN_FAULT 115 | ||
105 | |||
106 | #ifdef __cplusplus | ||
107 | } | ||
108 | #endif | ||
109 | #endif | ||
diff --git a/src/lib/libssl/src/util/pod2mantest b/src/lib/libssl/src/util/pod2mantest new file mode 100644 index 0000000000..79aefafac0 --- /dev/null +++ b/src/lib/libssl/src/util/pod2mantest | |||
@@ -0,0 +1,53 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | # This script is used by test/Makefile.ssl to check whether a sane 'pod2man' | ||
4 | # is installed. | ||
5 | # ('make install' should not try to run 'pod2man' if it does not exist or if | ||
6 | # it is a broken 'pod2man' version that is known to cause trouble. if we find | ||
7 | # the system 'pod2man' to be broken, we use our own copy instead) | ||
8 | # | ||
9 | # In any case, output an appropriate command line for running (or not | ||
10 | # running) pod2man. | ||
11 | |||
12 | |||
13 | IFS=: | ||
14 | try_without_dir=true | ||
15 | # First we try "pod2man", then "$dir/pod2man" for each item in $PATH. | ||
16 | for dir in dummy:$PATH; do | ||
17 | if [ "$try_without_dir" = true ]; then | ||
18 | # first iteration | ||
19 | pod2man=pod2man | ||
20 | try_without_dir=false | ||
21 | else | ||
22 | # second and later iterations | ||
23 | pod2man="$dir/pod2man" | ||
24 | if [ ! -f "$pod2man" ]; then # '-x' is not available on Ultrix | ||
25 | pod2man='' | ||
26 | fi | ||
27 | fi | ||
28 | |||
29 | if [ ! "$pod2man" = '' ]; then | ||
30 | failure=none | ||
31 | |||
32 | |||
33 | if "$pod2man" --section=1 --center=OpenSSL --release=dev pod2mantest.pod | grep '^MARKER - ' >/dev/null 2>&1; then | ||
34 | failure=MultilineTest | ||
35 | fi | ||
36 | |||
37 | |||
38 | if [ "$failure" = none ]; then | ||
39 | echo "$pod2man" | ||
40 | exit 0 | ||
41 | fi | ||
42 | |||
43 | echo "$pod2man does not work properly ('$failure' failed). Looking for another pod2man ..." >&2 | ||
44 | fi | ||
45 | done | ||
46 | |||
47 | echo "No working pod2man found. Consider installing a new version." >&2 | ||
48 | if [ "$1" = ignore ]; then | ||
49 | echo "As a workaround, we'll use a bundled old copy of pod2man.pl." >&2 | ||
50 | echo "util/pod2man.pl" | ||
51 | exit 0 | ||
52 | fi | ||
53 | exit 1 | ||
diff --git a/src/lib/libssl/src/util/pod2mantest.pod b/src/lib/libssl/src/util/pod2mantest.pod new file mode 100644 index 0000000000..5d2539a17f --- /dev/null +++ b/src/lib/libssl/src/util/pod2mantest.pod | |||
@@ -0,0 +1,15 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | foo, bar, | ||
6 | MARKER - test of multiline name section | ||
7 | |||
8 | =head1 DESCRIPTION | ||
9 | |||
10 | This is a test .pod file to see if we have a buggy pod2man or not. | ||
11 | If we have a buggy implementation, we will get a line matching the | ||
12 | regular expression "^ +MARKER - test of multiline name section *$" | ||
13 | at the end of the resulting document. | ||
14 | |||
15 | =cut | ||