diff options
Diffstat (limited to 'src/lib/libcrypto')
87 files changed, 3706 insertions, 946 deletions
diff --git a/src/lib/libcrypto/bf/bftest.c b/src/lib/libcrypto/bf/bftest.c index 09895f2542..24d526b14b 100644 --- a/src/lib/libcrypto/bf/bftest.c +++ b/src/lib/libcrypto/bf/bftest.c | |||
@@ -63,6 +63,8 @@ | |||
63 | #include <string.h> | 63 | #include <string.h> |
64 | #include <stdlib.h> | 64 | #include <stdlib.h> |
65 | 65 | ||
66 | #include "../e_os.h" | ||
67 | |||
66 | #ifdef OPENSSL_NO_BF | 68 | #ifdef OPENSSL_NO_BF |
67 | int main(int argc, char *argv[]) | 69 | int main(int argc, char *argv[]) |
68 | { | 70 | { |
@@ -275,7 +277,7 @@ int main(int argc, char *argv[]) | |||
275 | else | 277 | else |
276 | ret=test(); | 278 | ret=test(); |
277 | 279 | ||
278 | exit(ret); | 280 | EXIT(ret); |
279 | return(0); | 281 | return(0); |
280 | } | 282 | } |
281 | 283 | ||
@@ -454,9 +456,9 @@ static int test(void) | |||
454 | len=strlen(cbc_data)+1; | 456 | len=strlen(cbc_data)+1; |
455 | 457 | ||
456 | BF_set_key(&key,16,cbc_key); | 458 | BF_set_key(&key,16,cbc_key); |
457 | memset(cbc_in,0,40); | 459 | memset(cbc_in,0,sizeof cbc_in); |
458 | memset(cbc_out,0,40); | 460 | memset(cbc_out,0,sizeof cbc_out); |
459 | memcpy(iv,cbc_iv,8); | 461 | memcpy(iv,cbc_iv,sizeof iv); |
460 | BF_cbc_encrypt((unsigned char *)cbc_data,cbc_out,len, | 462 | BF_cbc_encrypt((unsigned char *)cbc_data,cbc_out,len, |
461 | &key,iv,BF_ENCRYPT); | 463 | &key,iv,BF_ENCRYPT); |
462 | if (memcmp(cbc_out,cbc_ok,32) != 0) | 464 | if (memcmp(cbc_out,cbc_ok,32) != 0) |
diff --git a/src/lib/libcrypto/bn/asm/vms.mar b/src/lib/libcrypto/bn/asm/vms.mar index 465f2774b6..aefab15cdb 100644 --- a/src/lib/libcrypto/bn/asm/vms.mar +++ b/src/lib/libcrypto/bn/asm/vms.mar | |||
@@ -1,4 +1,4 @@ | |||
1 | .title vax_bn_mul_add_word unsigned multiply & add, 32*32+32+32=>64 | 1 | .title vax_bn_mul_add_words unsigned multiply & add, 32*32+32+32=>64 |
2 | ; | 2 | ; |
3 | ; w.j.m. 15-jan-1999 | 3 | ; w.j.m. 15-jan-1999 |
4 | ; | 4 | ; |
@@ -59,7 +59,7 @@ w=16 ;(AP) w by value (input) | |||
59 | movl r6,r0 ; return c | 59 | movl r6,r0 ; return c |
60 | ret | 60 | ret |
61 | 61 | ||
62 | .title vax_bn_mul_word unsigned multiply & add, 32*32+32=>64 | 62 | .title vax_bn_mul_words unsigned multiply & add, 32*32+32=>64 |
63 | ; | 63 | ; |
64 | ; w.j.m. 15-jan-1999 | 64 | ; w.j.m. 15-jan-1999 |
65 | ; | 65 | ; |
@@ -172,147 +172,175 @@ n=12 ;(AP) n by value (input) | |||
172 | ; } | 172 | ; } |
173 | ; | 173 | ; |
174 | ; Using EDIV would be very easy, if it didn't do signed calculations. | 174 | ; Using EDIV would be very easy, if it didn't do signed calculations. |
175 | ; Therefore, som extra things have to happen around it. The way to | 175 | ; Any time any of the input numbers are signed, there are problems, |
176 | ; handle that is to shift all operands right one step (basically dividing | 176 | ; usually with integer overflow, at which point it returns useless |
177 | ; them by 2) and handle the different cases depending on what the lowest | 177 | ; data (the quotient gets the value of l, and the remainder becomes 0). |
178 | ; bit of each operand was. | ||
179 | ; | 178 | ; |
180 | ; To start with, let's define the following: | 179 | ; If it was just for the dividend, it would be very easy, just divide |
180 | ; it by 2 (unsigned), do the division, multiply the resulting quotient | ||
181 | ; and remainder by 2, add the bit that was dropped when dividing by 2 | ||
182 | ; to the remainder, and do some adjustment so the remainder doesn't | ||
183 | ; end up larger than the divisor. For some cases when the divisor is | ||
184 | ; negative (from EDIV's point of view, i.e. when the highest bit is set), | ||
185 | ; dividing the dividend by 2 isn't enough, and since some operations | ||
186 | ; might generate integer overflows even when the dividend is divided by | ||
187 | ; 4 (when the high part of the shifted down dividend ends up being exactly | ||
188 | ; half of the divisor, the result is the quotient 0x80000000, which is | ||
189 | ; negative...) it needs to be divided by 8. Furthermore, the divisor needs | ||
190 | ; to be divided by 2 (unsigned) as well, to avoid more problems with the sign. | ||
191 | ; In this case, a little extra fiddling with the remainder is required. | ||
181 | ; | 192 | ; |
182 | ; a' = l & 1 | 193 | ; So, the simplest way to handle this is always to divide the dividend |
183 | ; a2 = <h,l> >> 1 # UNSIGNED shift! | 194 | ; by 8, and to divide the divisor by 2 if it's highest bit is set. |
184 | ; b' = d & 1 | 195 | ; After EDIV has been used, the quotient gets multiplied by 8 if the |
185 | ; b2 = d >> 1 # UNSIGNED shift! | 196 | ; original divisor was positive, otherwise 4. The remainder, oddly |
197 | ; enough, is *always* multiplied by 8. | ||
198 | ; NOTE: in the case mentioned above, where the high part of the shifted | ||
199 | ; down dividend ends up being exactly half the shifted down divisor, we | ||
200 | ; end up with a 33 bit quotient. That's no problem however, it usually | ||
201 | ; means we have ended up with a too large remainder as well, and the | ||
202 | ; problem is fixed by the last part of the algorithm (next paragraph). | ||
186 | ; | 203 | ; |
187 | ; Now, use EDIV to calculate a quotient and a remainder: | 204 | ; The routine ends with comparing the resulting remainder with the |
205 | ; original divisor and if the remainder is larger, subtract the | ||
206 | ; original divisor from it, and increase the quotient by 1. This is | ||
207 | ; done until the remainder is smaller than the divisor. | ||
188 | ; | 208 | ; |
189 | ; q'' = a2/b2 | 209 | ; The complete algorithm looks like this: |
190 | ; r'' = a2 - q''*b2 | ||
191 | ; | 210 | ; |
192 | ; If b' is 0, the quotient is already correct, we just need to adjust the | 211 | ; d' = d |
193 | ; remainder: | 212 | ; l' = l & 7 |
213 | ; [h,l] = [h,l] >> 3 | ||
214 | ; [q,r] = floor([h,l] / d) # This is the EDIV operation | ||
215 | ; if (q < 0) q = -q # I doubt this is necessary any more | ||
194 | ; | 216 | ; |
195 | ; if (b' == 0) | 217 | ; r' = r >> 29 |
196 | ; { | 218 | ; if (d' >= 0) |
197 | ; r = 2*r'' + a' | 219 | ; q' = q >> 29 |
198 | ; q = q'' | 220 | ; q = q << 3 |
199 | ; } | 221 | ; else |
200 | ; | 222 | ; q' = q >> 30 |
201 | ; If b' is 1, we need to do other adjustements. The first thought is the | 223 | ; q = q << 2 |
202 | ; following (note that r' will not always have the right value, but an | 224 | ; r = (r << 3) + l' |
203 | ; adjustement follows further down): | ||
204 | ; | ||
205 | ; if (b' == 1) | ||
206 | ; { | ||
207 | ; q' = q'' | ||
208 | ; r' = a - q'*b | ||
209 | ; | ||
210 | ; However, one can note the folowing relationship: | ||
211 | ; | ||
212 | ; r'' = a2 - q''*b2 | ||
213 | ; => 2*r'' = 2*a2 - 2*q''*b2 | ||
214 | ; = { a = 2*a2 + a', b = 2*b2 + b' = 2*b2 + 1, | ||
215 | ; q' = q'' } | ||
216 | ; = a - a' - q'*(b - 1) | ||
217 | ; = a - q'*b - a' + q' | ||
218 | ; = r' - a' + q' | ||
219 | ; => r' = 2*r'' - q' + a' | ||
220 | ; | 225 | ; |
221 | ; This enables us to use r'' instead of discarding and calculating another | 226 | ; if (d' < 0) |
222 | ; modulo: | ||
223 | ; | ||
224 | ; if (b' == 1) | ||
225 | ; { | 227 | ; { |
226 | ; q' = q'' | 228 | ; [r',r] = [r',r] - q |
227 | ; r' = (r'' << 1) - q' + a' | 229 | ; while ([r',r] < 0) |
228 | ; | ||
229 | ; Now, all we have to do is adjust r', because it might be < 0: | ||
230 | ; | ||
231 | ; while (r' < 0) | ||
232 | ; { | 230 | ; { |
233 | ; r' = r' + b | 231 | ; [r',r] = [r',r] + d |
234 | ; q' = q' - 1 | 232 | ; [q',q] = [q',q] - 1 |
235 | ; } | 233 | ; } |
236 | ; } | 234 | ; } |
237 | ; | 235 | ; |
238 | ; return q' | 236 | ; while ([r',r] >= d') |
237 | ; { | ||
238 | ; [r',r] = [r',r] - d' | ||
239 | ; [q',q] = [q',q] + 1 | ||
240 | ; } | ||
241 | ; | ||
242 | ; return q | ||
239 | 243 | ||
240 | h=4 ;(AP) h by value (input) | 244 | h=4 ;(AP) h by value (input) |
241 | l=8 ;(AP) l by value (input) | 245 | l=8 ;(AP) l by value (input) |
242 | d=12 ;(AP) d by value (input) | 246 | d=12 ;(AP) d by value (input) |
243 | 247 | ||
244 | ;aprim=r5 | 248 | ;r2 = l, q |
245 | ;a2=r6 | 249 | ;r3 = h, r |
246 | ;a20=r6 | 250 | ;r4 = d |
247 | ;a21=r7 | 251 | ;r5 = l' |
248 | ;bprim=r8 | 252 | ;r6 = r' |
249 | ;b2=r9 | 253 | ;r7 = d' |
250 | ;qprim=r10 ; initially used as q'' | 254 | ;r8 = q' |
251 | ;rprim=r11 ; initially used as r'' | ||
252 | |||
253 | 255 | ||
254 | .psect code,nowrt | 256 | .psect code,nowrt |
255 | 257 | ||
256 | .entry bn_div_words,^m<r2,r3,r4,r5,r6,r7,r8,r9,r10,r11> | 258 | .entry bn_div_words,^m<r2,r3,r4,r5,r6,r7,r8> |
257 | movl l(ap),r2 | 259 | movl l(ap),r2 |
258 | movl h(ap),r3 | 260 | movl h(ap),r3 |
259 | movl d(ap),r4 | 261 | movl d(ap),r4 |
260 | 262 | ||
261 | movl #0,r5 | 263 | bicl3 #^XFFFFFFF8,r2,r5 ; l' = l & 7 |
262 | movl #0,r8 | 264 | bicl3 #^X00000007,r2,r2 |
263 | movl #0,r0 | ||
264 | ; movl #0,r1 | ||
265 | 265 | ||
266 | rotl #-1,r2,r6 ; a20 = l >> 1 (almost) | 266 | bicl3 #^XFFFFFFF8,r3,r6 |
267 | rotl #-1,r3,r7 ; a21 = h >> 1 (almost) | 267 | bicl3 #^X00000007,r3,r3 |
268 | rotl #-1,r4,r9 ; b2 = d >> 1 (almost) | 268 | |
269 | addl r6,r2 | ||
269 | 270 | ||
270 | tstl r6 | 271 | rotl #-3,r2,r2 ; l = l >> 3 |
271 | bgeq 1$ | 272 | rotl #-3,r3,r3 ; h = h >> 3 |
272 | xorl2 #^X80000000,r6 ; fixup a20 so highest bit is 0 | 273 | |
273 | incl r5 ; a' = 1 | 274 | movl r4,r7 ; d' = d |
274 | 1$: | 275 | |
275 | tstl r7 | 276 | movl #0,r6 ; r' = 0 |
276 | bgeq 2$ | 277 | movl #0,r8 ; q' = 0 |
277 | xorl2 #^X80000000,r6 ; fixup a20 so highest bit is 1, | 278 | |
278 | ; since that's what was lowest in a21 | 279 | tstl r4 |
279 | xorl2 #^X80000000,r7 ; fixup a21 so highest bit is 1 | ||
280 | 2$: | ||
281 | tstl r9 | ||
282 | beql 666$ ; Uh-oh, the divisor is 0... | 280 | beql 666$ ; Uh-oh, the divisor is 0... |
283 | bgtr 3$ | 281 | bgtr 1$ |
284 | xorl2 #^X80000000,r9 ; fixup b2 so highest bit is 0 | 282 | rotl #-1,r4,r4 ; If d is negative, shift it right. |
285 | incl r8 ; b' = 1 | 283 | bicl2 #^X80000000,r4 ; Since d is then a large number, the |
286 | 3$: | 284 | ; lowest bit is insignificant |
287 | tstl r9 | 285 | ; (contradict that, and I'll fix the problem!) |
288 | bneq 4$ ; if b2 is 0, we know that b' is 1 | 286 | 1$: |
289 | tstl r3 | 287 | ediv r4,r2,r2,r3 ; Do the actual division |
290 | bneq 666$ ; if higher half isn't 0, we overflow | 288 | |
291 | movl r2,r10 ; otherwise, we have our result | 289 | tstl r2 |
292 | brb 42$ ; This is a success, really. | 290 | bgeq 3$ |
293 | 4$: | 291 | mnegl r2,r2 ; if q < 0, negate it |
294 | ediv r9,r6,r10,r11 | 292 | 3$: |
295 | 293 | tstl r7 | |
296 | tstl r8 | 294 | blss 4$ |
297 | bneq 5$ ; If b' != 0, go to the other part | 295 | rotl #3,r2,r2 ; q = q << 3 |
298 | ; addl3 r11,r11,r1 | 296 | bicl3 #^XFFFFFFF8,r2,r8 ; q' gets the high bits from q |
299 | ; addl2 r5,r1 | 297 | bicl3 #^X00000007,r2,r2 |
300 | brb 42$ | 298 | bsb 41$ |
301 | 5$: | 299 | 4$: ; else |
302 | ashl #1,r11,r11 | 300 | rotl #2,r2,r2 ; q = q << 2 |
303 | subl2 r10,r11 | 301 | bicl3 #^XFFFFFFFC,r2,r8 ; q' gets the high bits from q |
304 | addl2 r5,r11 | 302 | bicl3 #^X00000003,r2,r2 |
305 | bgeq 7$ | 303 | 41$: |
306 | 6$: | 304 | rotl #3,r3,r3 ; r = r << 3 |
307 | decl r10 | 305 | bicl3 #^XFFFFFFF8,r3,r6 ; r' gets the high bits from r |
308 | addl2 r4,r11 | 306 | bicl3 #^X00000007,r3,r3 |
309 | blss 6$ | 307 | addl r5,r3 ; r = r + l' |
310 | 7$: | 308 | |
311 | ; movl r11,r1 | 309 | tstl r7 |
310 | bgeq 5$ | ||
311 | bitl #1,r7 | ||
312 | beql 5$ ; if d' < 0 && d' & 1 | ||
313 | subl r2,r3 ; [r',r] = [r',r] - [q',q] | ||
314 | sbwc r8,r6 | ||
315 | 45$: | ||
316 | bgeq 5$ ; while r < 0 | ||
317 | decl r2 ; [q',q] = [q',q] - 1 | ||
318 | sbwc #0,r8 | ||
319 | addl r7,r3 ; [r',r] = [r',r] + d' | ||
320 | adwc #0,r6 | ||
321 | brb 45$ | ||
322 | |||
323 | ; The return points are placed in the middle to keep a short distance from | ||
324 | ; all the branch points | ||
312 | 42$: | 325 | 42$: |
313 | movl r10,r0 | 326 | ; movl r3,r1 |
327 | movl r2,r0 | ||
328 | ret | ||
314 | 666$: | 329 | 666$: |
330 | movl #^XFFFFFFFF,r0 | ||
315 | ret | 331 | ret |
332 | |||
333 | 5$: | ||
334 | tstl r6 | ||
335 | bneq 6$ | ||
336 | cmpl r3,r7 | ||
337 | blssu 42$ ; while [r',r] >= d' | ||
338 | 6$: | ||
339 | subl r7,r3 ; [r',r] = [r',r] - d' | ||
340 | sbwc #0,r6 | ||
341 | incl r2 ; [q',q] = [q',q] + 1 | ||
342 | adwc #0,r8 | ||
343 | brb 5$ | ||
316 | 344 | ||
317 | .title vax_bn_add_words unsigned add of two arrays | 345 | .title vax_bn_add_words unsigned add of two arrays |
318 | ; | 346 | ; |
diff --git a/src/lib/libcrypto/bn/bntest.c b/src/lib/libcrypto/bn/bntest.c index 8158a67374..3c8c540387 100644 --- a/src/lib/libcrypto/bn/bntest.c +++ b/src/lib/libcrypto/bn/bntest.c | |||
@@ -68,10 +68,6 @@ | |||
68 | #include <openssl/x509.h> | 68 | #include <openssl/x509.h> |
69 | #include <openssl/err.h> | 69 | #include <openssl/err.h> |
70 | 70 | ||
71 | #ifdef OPENSSL_SYS_WINDOWS | ||
72 | #include "../bio/bss_file.c" | ||
73 | #endif | ||
74 | |||
75 | const int num0 = 100; /* number of tests */ | 71 | const int num0 = 100; /* number of tests */ |
76 | const int num1 = 50; /* additional tests for some functions */ | 72 | const int num1 = 50; /* additional tests for some functions */ |
77 | const int num2 = 5; /* number of tests for slow functions */ | 73 | const int num2 = 5; /* number of tests for slow functions */ |
@@ -96,11 +92,6 @@ int test_sqrt(BIO *bp,BN_CTX *ctx); | |||
96 | int rand_neg(void); | 92 | int rand_neg(void); |
97 | static int results=0; | 93 | static int results=0; |
98 | 94 | ||
99 | #ifdef OPENSSL_NO_STDIO | ||
100 | #define APPS_WIN16 | ||
101 | #include "bss_file.c" | ||
102 | #endif | ||
103 | |||
104 | static unsigned char lst[]="\xC6\x4F\x43\x04\x2A\xEA\xCA\x6E\x58\x36\x80\x5B\xE8\xC9" | 95 | static unsigned char lst[]="\xC6\x4F\x43\x04\x2A\xEA\xCA\x6E\x58\x36\x80\x5B\xE8\xC9" |
105 | "\x9B\x04\x5D\x48\x36\xC2\xFD\x16\xC9\x64\xF0"; | 96 | "\x9B\x04\x5D\x48\x36\xC2\xFD\x16\xC9\x64\xF0"; |
106 | 97 | ||
@@ -141,10 +132,10 @@ int main(int argc, char *argv[]) | |||
141 | 132 | ||
142 | 133 | ||
143 | ctx=BN_CTX_new(); | 134 | ctx=BN_CTX_new(); |
144 | if (ctx == NULL) exit(1); | 135 | if (ctx == NULL) EXIT(1); |
145 | 136 | ||
146 | out=BIO_new(BIO_s_file()); | 137 | out=BIO_new(BIO_s_file()); |
147 | if (out == NULL) exit(1); | 138 | if (out == NULL) EXIT(1); |
148 | if (outfile == NULL) | 139 | if (outfile == NULL) |
149 | { | 140 | { |
150 | BIO_set_fp(out,stdout,BIO_NOCLOSE); | 141 | BIO_set_fp(out,stdout,BIO_NOCLOSE); |
@@ -154,7 +145,7 @@ int main(int argc, char *argv[]) | |||
154 | if (!BIO_write_filename(out,outfile)) | 145 | if (!BIO_write_filename(out,outfile)) |
155 | { | 146 | { |
156 | perror(outfile); | 147 | perror(outfile); |
157 | exit(1); | 148 | EXIT(1); |
158 | } | 149 | } |
159 | } | 150 | } |
160 | 151 | ||
@@ -238,14 +229,14 @@ int main(int argc, char *argv[]) | |||
238 | BIO_free(out); | 229 | BIO_free(out); |
239 | 230 | ||
240 | /**/ | 231 | /**/ |
241 | exit(0); | 232 | EXIT(0); |
242 | err: | 233 | err: |
243 | BIO_puts(out,"1\n"); /* make sure the Perl script fed by bc notices | 234 | BIO_puts(out,"1\n"); /* make sure the Perl script fed by bc notices |
244 | * the failure, see test_bn in test/Makefile.ssl*/ | 235 | * the failure, see test_bn in test/Makefile.ssl*/ |
245 | BIO_flush(out); | 236 | BIO_flush(out); |
246 | ERR_load_crypto_strings(); | 237 | ERR_load_crypto_strings(); |
247 | ERR_print_errors_fp(stderr); | 238 | ERR_print_errors_fp(stderr); |
248 | exit(1); | 239 | EXIT(1); |
249 | return(1); | 240 | return(1); |
250 | } | 241 | } |
251 | 242 | ||
@@ -488,7 +479,7 @@ int test_mul(BIO *bp) | |||
488 | BN_CTX *ctx; | 479 | BN_CTX *ctx; |
489 | 480 | ||
490 | ctx = BN_CTX_new(); | 481 | ctx = BN_CTX_new(); |
491 | if (ctx == NULL) exit(1); | 482 | if (ctx == NULL) EXIT(1); |
492 | 483 | ||
493 | BN_init(&a); | 484 | BN_init(&a); |
494 | BN_init(&b); | 485 | BN_init(&b); |
@@ -726,7 +717,7 @@ int test_mod_mul(BIO *bp, BN_CTX *ctx) | |||
726 | while ((l=ERR_get_error())) | 717 | while ((l=ERR_get_error())) |
727 | fprintf(stderr,"ERROR:%s\n", | 718 | fprintf(stderr,"ERROR:%s\n", |
728 | ERR_error_string(l,NULL)); | 719 | ERR_error_string(l,NULL)); |
729 | exit(1); | 720 | EXIT(1); |
730 | } | 721 | } |
731 | if (bp != NULL) | 722 | if (bp != NULL) |
732 | { | 723 | { |
diff --git a/src/lib/libcrypto/bn/divtest.c b/src/lib/libcrypto/bn/divtest.c index 13ba86e3c4..d3fc688f33 100644 --- a/src/lib/libcrypto/bn/divtest.c +++ b/src/lib/libcrypto/bn/divtest.c | |||
@@ -1,7 +1,7 @@ | |||
1 | #include <openssl/bn.h> | 1 | #include <openssl/bn.h> |
2 | #include <openssl/rand.h> | 2 | #include <openssl/rand.h> |
3 | 3 | ||
4 | static int rand(n) | 4 | static int Rand(n) |
5 | { | 5 | { |
6 | unsigned char x[2]; | 6 | unsigned char x[2]; |
7 | RAND_pseudo_bytes(x,2); | 7 | RAND_pseudo_bytes(x,2); |
@@ -26,8 +26,8 @@ main() | |||
26 | BN_CTX *ctx=BN_CTX_new(); | 26 | BN_CTX *ctx=BN_CTX_new(); |
27 | 27 | ||
28 | for(;;) { | 28 | for(;;) { |
29 | BN_pseudo_rand(a,rand(),0,0); | 29 | BN_pseudo_rand(a,Rand(),0,0); |
30 | BN_pseudo_rand(b,rand(),0,0); | 30 | BN_pseudo_rand(b,Rand(),0,0); |
31 | if (BN_is_zero(b)) continue; | 31 | if (BN_is_zero(b)) continue; |
32 | 32 | ||
33 | BN_RECP_CTX_set(recp,b,ctx); | 33 | BN_RECP_CTX_set(recp,b,ctx); |
diff --git a/src/lib/libcrypto/bn/exptest.c b/src/lib/libcrypto/bn/exptest.c index 5ca570d1a8..b09cf88705 100644 --- a/src/lib/libcrypto/bn/exptest.c +++ b/src/lib/libcrypto/bn/exptest.c | |||
@@ -59,13 +59,13 @@ | |||
59 | #include <stdio.h> | 59 | #include <stdio.h> |
60 | #include <stdlib.h> | 60 | #include <stdlib.h> |
61 | #include <string.h> | 61 | #include <string.h> |
62 | |||
63 | #include "../e_os.h" | ||
64 | |||
62 | #include <openssl/bio.h> | 65 | #include <openssl/bio.h> |
63 | #include <openssl/bn.h> | 66 | #include <openssl/bn.h> |
64 | #include <openssl/rand.h> | 67 | #include <openssl/rand.h> |
65 | #include <openssl/err.h> | 68 | #include <openssl/err.h> |
66 | #ifdef OPENSSL_SYS_WINDOWS | ||
67 | #include "../bio/bss_file.c" | ||
68 | #endif | ||
69 | 69 | ||
70 | #define NUM_BITS (BN_BITS*2) | 70 | #define NUM_BITS (BN_BITS*2) |
71 | 71 | ||
@@ -86,7 +86,7 @@ int main(int argc, char *argv[]) | |||
86 | ERR_load_BN_strings(); | 86 | ERR_load_BN_strings(); |
87 | 87 | ||
88 | ctx=BN_CTX_new(); | 88 | ctx=BN_CTX_new(); |
89 | if (ctx == NULL) exit(1); | 89 | if (ctx == NULL) EXIT(1); |
90 | r_mont=BN_new(); | 90 | r_mont=BN_new(); |
91 | r_recp=BN_new(); | 91 | r_recp=BN_new(); |
92 | r_simple=BN_new(); | 92 | r_simple=BN_new(); |
@@ -99,7 +99,7 @@ int main(int argc, char *argv[]) | |||
99 | 99 | ||
100 | out=BIO_new(BIO_s_file()); | 100 | out=BIO_new(BIO_s_file()); |
101 | 101 | ||
102 | if (out == NULL) exit(1); | 102 | if (out == NULL) EXIT(1); |
103 | BIO_set_fp(out,stdout,BIO_NOCLOSE); | 103 | BIO_set_fp(out,stdout,BIO_NOCLOSE); |
104 | 104 | ||
105 | for (i=0; i<200; i++) | 105 | for (i=0; i<200; i++) |
@@ -124,7 +124,7 @@ int main(int argc, char *argv[]) | |||
124 | { | 124 | { |
125 | printf("BN_mod_exp_mont() problems\n"); | 125 | printf("BN_mod_exp_mont() problems\n"); |
126 | ERR_print_errors(out); | 126 | ERR_print_errors(out); |
127 | exit(1); | 127 | EXIT(1); |
128 | } | 128 | } |
129 | 129 | ||
130 | ret=BN_mod_exp_recp(r_recp,a,b,m,ctx); | 130 | ret=BN_mod_exp_recp(r_recp,a,b,m,ctx); |
@@ -132,7 +132,7 @@ int main(int argc, char *argv[]) | |||
132 | { | 132 | { |
133 | printf("BN_mod_exp_recp() problems\n"); | 133 | printf("BN_mod_exp_recp() problems\n"); |
134 | ERR_print_errors(out); | 134 | ERR_print_errors(out); |
135 | exit(1); | 135 | EXIT(1); |
136 | } | 136 | } |
137 | 137 | ||
138 | ret=BN_mod_exp_simple(r_simple,a,b,m,ctx); | 138 | ret=BN_mod_exp_simple(r_simple,a,b,m,ctx); |
@@ -140,7 +140,7 @@ int main(int argc, char *argv[]) | |||
140 | { | 140 | { |
141 | printf("BN_mod_exp_simple() problems\n"); | 141 | printf("BN_mod_exp_simple() problems\n"); |
142 | ERR_print_errors(out); | 142 | ERR_print_errors(out); |
143 | exit(1); | 143 | EXIT(1); |
144 | } | 144 | } |
145 | 145 | ||
146 | if (BN_cmp(r_simple, r_mont) == 0 | 146 | if (BN_cmp(r_simple, r_mont) == 0 |
@@ -163,7 +163,7 @@ int main(int argc, char *argv[]) | |||
163 | printf("\nrecp ="); BN_print(out,r_recp); | 163 | printf("\nrecp ="); BN_print(out,r_recp); |
164 | printf("\nmont ="); BN_print(out,r_mont); | 164 | printf("\nmont ="); BN_print(out,r_mont); |
165 | printf("\n"); | 165 | printf("\n"); |
166 | exit(1); | 166 | EXIT(1); |
167 | } | 167 | } |
168 | } | 168 | } |
169 | BN_free(r_mont); | 169 | BN_free(r_mont); |
@@ -177,11 +177,11 @@ int main(int argc, char *argv[]) | |||
177 | CRYPTO_mem_leaks(out); | 177 | CRYPTO_mem_leaks(out); |
178 | BIO_free(out); | 178 | BIO_free(out); |
179 | printf(" done\n"); | 179 | printf(" done\n"); |
180 | exit(0); | 180 | EXIT(0); |
181 | err: | 181 | err: |
182 | ERR_load_crypto_strings(); | 182 | ERR_load_crypto_strings(); |
183 | ERR_print_errors(out); | 183 | ERR_print_errors(out); |
184 | exit(1); | 184 | EXIT(1); |
185 | return(1); | 185 | return(1); |
186 | } | 186 | } |
187 | 187 | ||
diff --git a/src/lib/libcrypto/cast/casttest.c b/src/lib/libcrypto/cast/casttest.c index 099e790886..83e5a16c73 100644 --- a/src/lib/libcrypto/cast/casttest.c +++ b/src/lib/libcrypto/cast/casttest.c | |||
@@ -60,6 +60,8 @@ | |||
60 | #include <string.h> | 60 | #include <string.h> |
61 | #include <stdlib.h> | 61 | #include <stdlib.h> |
62 | 62 | ||
63 | #include "../e_os.h" | ||
64 | |||
63 | #ifdef OPENSSL_NO_CAST | 65 | #ifdef OPENSSL_NO_CAST |
64 | int main(int argc, char *argv[]) | 66 | int main(int argc, char *argv[]) |
65 | { | 67 | { |
@@ -224,7 +226,7 @@ int main(int argc, char *argv[]) | |||
224 | } | 226 | } |
225 | #endif | 227 | #endif |
226 | 228 | ||
227 | exit(err); | 229 | EXIT(err); |
228 | return(err); | 230 | return(err); |
229 | } | 231 | } |
230 | #endif | 232 | #endif |
diff --git a/src/lib/libcrypto/crypto-lib.com b/src/lib/libcrypto/crypto-lib.com index dfcff11860..39e78c69e5 100644 --- a/src/lib/libcrypto/crypto-lib.com +++ b/src/lib/libcrypto/crypto-lib.com | |||
@@ -21,22 +21,10 @@ $! LIBRARY To just compile the [.xxx.EXE.CRYPTO]LIBCRYPTO.OLB Library. | |||
21 | $! APPS To just compile the [.xxx.EXE.CRYPTO]*.EXE | 21 | $! APPS To just compile the [.xxx.EXE.CRYPTO]*.EXE |
22 | $! ALL To do both LIBRARY and APPS | 22 | $! ALL To do both LIBRARY and APPS |
23 | $! | 23 | $! |
24 | $! Specify RSAREF as P2 to compile with the RSAREF library instead of | 24 | $! Specify DEBUG or NODEBUG as P2 to compile with or without debugger |
25 | $! the regular one. If you specify NORSAREF it will compile with the | ||
26 | $! regular RSAREF routines. (Note: If you are in the United States | ||
27 | $! you MUST compile with RSAREF unless you have a license from RSA). | ||
28 | $! | ||
29 | $! Note: The RSAREF libraries are NOT INCLUDED and you have to | ||
30 | $! download it from "ftp://ftp.rsa.com/rsaref". You have to | ||
31 | $! get the ".tar-Z" file as the ".zip" file dosen't have the | ||
32 | $! directory structure stored. You have to extract the file | ||
33 | $! into the [.RSAREF] directory under the root directory as that | ||
34 | $! is where the scripts will look for the files. | ||
35 | $! | ||
36 | $! Specify DEBUG or NODEBUG as P3 to compile with or without debugger | ||
37 | $! information. | 25 | $! information. |
38 | $! | 26 | $! |
39 | $! Specify which compiler at P4 to try to compile under. | 27 | $! Specify which compiler at P3 to try to compile under. |
40 | $! | 28 | $! |
41 | $! VAXC For VAX C. | 29 | $! VAXC For VAX C. |
42 | $! DECC For DEC C. | 30 | $! DECC For DEC C. |
@@ -45,16 +33,16 @@ $! | |||
45 | $! If you don't speficy a compiler, it will try to determine which | 33 | $! If you don't speficy a compiler, it will try to determine which |
46 | $! "C" compiler to use. | 34 | $! "C" compiler to use. |
47 | $! | 35 | $! |
48 | $! P5, if defined, sets a TCP/IP library to use, through one of the following | 36 | $! P4, if defined, sets a TCP/IP library to use, through one of the following |
49 | $! keywords: | 37 | $! keywords: |
50 | $! | 38 | $! |
51 | $! UCX for UCX | 39 | $! UCX for UCX |
52 | $! TCPIP for TCPIP (post UCX) | 40 | $! TCPIP for TCPIP (post UCX) |
53 | $! SOCKETSHR for SOCKETSHR+NETLIB | 41 | $! SOCKETSHR for SOCKETSHR+NETLIB |
54 | $! | 42 | $! |
55 | $! P6, if defined, sets a compiler thread NOT needed on OpenVMS 7.1 (and up) | 43 | $! P5, if defined, sets a compiler thread NOT needed on OpenVMS 7.1 (and up) |
56 | $! | 44 | $! |
57 | $! P7, if defined, sets a choice of crypto methods to compile. | 45 | $! P6, if defined, sets a choice of crypto methods to compile. |
58 | $! WARNING: this should only be done to recompile some part of an already | 46 | $! WARNING: this should only be done to recompile some part of an already |
59 | $! fully compiled library. | 47 | $! fully compiled library. |
60 | $! | 48 | $! |
@@ -93,7 +81,6 @@ $ ENCRYPT_TYPES = "Basic,MD2,MD4,MD5,SHA,MDC2,HMAC,RIPEMD,"+ - | |||
93 | "BUFFER,BIO,STACK,LHASH,RAND,ERR,OBJECTS,"+ - | 81 | "BUFFER,BIO,STACK,LHASH,RAND,ERR,OBJECTS,"+ - |
94 | "EVP,EVP_2,ASN1,ASN1_2,PEM,X509,X509V3,"+ - | 82 | "EVP,EVP_2,ASN1,ASN1_2,PEM,X509,X509V3,"+ - |
95 | "CONF,TXT_DB,PKCS7,PKCS12,COMP,OCSP,UI,KRB5" | 83 | "CONF,TXT_DB,PKCS7,PKCS12,COMP,OCSP,UI,KRB5" |
96 | $ ENCRYPT_PROGRAMS = "DES,PKCS7" | ||
97 | $! | 84 | $! |
98 | $! Check To Make Sure We Have Valid Command Line Parameters. | 85 | $! Check To Make Sure We Have Valid Command Line Parameters. |
99 | $! | 86 | $! |
@@ -149,10 +136,6 @@ $! Define The CRYPTO-LIB We Are To Use. | |||
149 | $! | 136 | $! |
150 | $ CRYPTO_LIB := 'EXE_DIR'LIBCRYPTO.OLB | 137 | $ CRYPTO_LIB := 'EXE_DIR'LIBCRYPTO.OLB |
151 | $! | 138 | $! |
152 | $! Define The RSAREF-LIB We Are To Use. | ||
153 | $! | ||
154 | $ RSAREF_LIB := SYS$DISK:[-.'ARCH'.EXE.RSAREF]LIBRSAGLUE.OLB | ||
155 | $! | ||
156 | $! Check To See If We Already Have A "[.xxx.EXE.CRYPTO]LIBCRYPTO.OLB" Library... | 139 | $! Check To See If We Already Have A "[.xxx.EXE.CRYPTO]LIBCRYPTO.OLB" Library... |
157 | $! | 140 | $! |
158 | $ IF (F$SEARCH(LIB_NAME).EQS."") | 141 | $ IF (F$SEARCH(LIB_NAME).EQS."") |
@@ -175,7 +158,7 @@ $! | |||
175 | $ APPS_DES = "DES/DES,CBC3_ENC" | 158 | $ APPS_DES = "DES/DES,CBC3_ENC" |
176 | $ APPS_PKCS7 = "ENC/ENC;DEC/DEC;SIGN/SIGN;VERIFY/VERIFY,EXAMPLE" | 159 | $ APPS_PKCS7 = "ENC/ENC;DEC/DEC;SIGN/SIGN;VERIFY/VERIFY,EXAMPLE" |
177 | $ | 160 | $ |
178 | $ LIB_ = "cryptlib,mem,mem_dbg,cversion,ex_data,tmdiff,cpt_err,ebcdic,uid,o_time" | 161 | $ LIB_ = "cryptlib,mem,mem_clr,mem_dbg,cversion,ex_data,tmdiff,cpt_err,ebcdic,uid,o_time" |
179 | $ LIB_MD2 = "md2_dgst,md2_one" | 162 | $ LIB_MD2 = "md2_dgst,md2_one" |
180 | $ LIB_MD4 = "md4_dgst,md4_one" | 163 | $ LIB_MD4 = "md4_dgst,md4_one" |
181 | $ LIB_MD5 = "md5_dgst,md5_one" | 164 | $ LIB_MD5 = "md5_dgst,md5_one" |
@@ -216,7 +199,7 @@ $ LIB_ENGINE = "eng_err,eng_lib,eng_list,eng_init,eng_ctrl,"+ - | |||
216 | "tb_rsa,tb_dsa,tb_dh,tb_rand,tb_cipher,tb_digest,"+ - | 199 | "tb_rsa,tb_dsa,tb_dh,tb_rand,tb_cipher,tb_digest,"+ - |
217 | "eng_openssl,eng_dyn,eng_cnf,"+ - | 200 | "eng_openssl,eng_dyn,eng_cnf,"+ - |
218 | "hw_atalla,hw_cswift,hw_ncipher,hw_nuron,hw_ubsec,"+ - | 201 | "hw_atalla,hw_cswift,hw_ncipher,hw_nuron,hw_ubsec,"+ - |
219 | "hw_openbsd_dev_crypto,hw_aep,hw_sureware,hw_4758_cca" | 202 | "hw_cryptodev,hw_aep,hw_sureware,hw_4758_cca" |
220 | $ LIB_AES = "aes_core,aes_misc,aes_ecb,aes_cbc,aes_cfb,aes_ofb,aes_ctr" | 203 | $ LIB_AES = "aes_core,aes_misc,aes_ecb,aes_cbc,aes_cfb,aes_ofb,aes_ctr" |
221 | $ LIB_BUFFER = "buffer,buf_err" | 204 | $ LIB_BUFFER = "buffer,buf_err" |
222 | $ LIB_BIO = "bio_lib,bio_cb,bio_err,"+ - | 205 | $ LIB_BIO = "bio_lib,bio_cb,bio_err,"+ - |
@@ -287,86 +270,6 @@ $ COMPILEWITH_CC4 = ",a_utctm,bss_log,o_time," | |||
287 | $ COMPILEWITH_CC5 = ",md2_dgst,md4_dgst,md5_dgst,mdc2dgst," + - | 270 | $ COMPILEWITH_CC5 = ",md2_dgst,md4_dgst,md5_dgst,mdc2dgst," + - |
288 | "sha_dgst,sha1dgst,rmd_dgst,bf_enc," | 271 | "sha_dgst,sha1dgst,rmd_dgst,bf_enc," |
289 | $! | 272 | $! |
290 | $! Check To See If We Are Going To Use RSAREF. | ||
291 | $! | ||
292 | $ IF (RSAREF.EQS."TRUE" .AND. ENCRYPT_TYPES - "RSA".NES.ENCRYPT_TYPES - | ||
293 | .AND. (BUILDALL .EQS. "TRUE" .OR. BUILDALL .EQS. "LIBRARY")) | ||
294 | $ THEN | ||
295 | $! | ||
296 | $! Check To See If The File [-.RSAREF]RSAREF.C Is Actually There. | ||
297 | $! | ||
298 | $ IF (F$SEARCH("SYS$DISK:[-.RSAREF]RSAREF.C").EQS."") | ||
299 | $ THEN | ||
300 | $! | ||
301 | $! Tell The User That The File Doesn't Exist. | ||
302 | $! | ||
303 | $ WRITE SYS$OUTPUT "" | ||
304 | $ WRITE SYS$OUTPUT "The File [-.RSAREF]RSAREF.C Doesn't Exist." | ||
305 | $ WRITE SYS$OUTPUT "" | ||
306 | $! | ||
307 | $! Exit The Build. | ||
308 | $! | ||
309 | $ GOTO EXIT | ||
310 | $! | ||
311 | $! End The [-.RSAREF]RSAREF.C Check. | ||
312 | $! | ||
313 | $ ENDIF | ||
314 | $! | ||
315 | $! Tell The User We Are Compiling The [-.RSAREF]RSAREF File. | ||
316 | $! | ||
317 | $ WRITE SYS$OUTPUT "Compiling The [-.RSAREF]RSAREF File." | ||
318 | $! | ||
319 | $! Compile [-.RSAREF]RSAREF.C | ||
320 | $! | ||
321 | $ CC/OBJECT='OBJ_DIR'RSAREF.OBJ SYS$DISK:[-.RSAREF]RSAREF.C | ||
322 | $! | ||
323 | $! Add It To The Library. | ||
324 | $! | ||
325 | $ LIBRARY/REPLACE 'LIB_NAME' 'OBJ_DIR'RSAREF.OBJ | ||
326 | $! | ||
327 | $! Delete The Object File. | ||
328 | $! | ||
329 | $ DELETE 'OBJ_DIR'RSAREF.OBJ;* | ||
330 | $! | ||
331 | $! Check To See If The File [-.RSAREF]RSAR_ERR.C Is Actually There. | ||
332 | $! | ||
333 | $ IF (F$SEARCH("SYS$DISK:[-.RSAREF]RSAR_ERR.C").EQS."") | ||
334 | $ THEN | ||
335 | $! | ||
336 | $! Tell The User That The File Doesn't Exist. | ||
337 | $! | ||
338 | $ WRITE SYS$OUTPUT "" | ||
339 | $ WRITE SYS$OUTPUT "The File [-.RSAREF]RSAR_ERR.C Doesn't Exist." | ||
340 | $ WRITE SYS$OUTPUT "" | ||
341 | $! | ||
342 | $! Exit The Build. | ||
343 | $! | ||
344 | $ GOTO EXIT | ||
345 | $! | ||
346 | $! End The [-.RSAREF]RSAR_ERR.C File Check. | ||
347 | $! | ||
348 | $ ENDIF | ||
349 | $! | ||
350 | $! Tell The User We Are Compiling The [-.RSAREF]RSAR_ERR File. | ||
351 | $! | ||
352 | $ WRITE SYS$OUTPUT "Compiling The [-.RSAREF]RSAR_ERR File." | ||
353 | $! | ||
354 | $! Compile [-.RSAREF]RSAR_ERR.C | ||
355 | $! | ||
356 | $ CC/OBJECT='OBJ_DIR'RSAR_ERR.OBJ SYS$DISK:[-.RSAREF]RSAR_ERR.C | ||
357 | $! | ||
358 | $! Add It To The Library. | ||
359 | $! | ||
360 | $ LIBRARY/REPLACE 'LIB_NAME' 'OBJ_DIR'RSAR_ERR.OBJ | ||
361 | $! | ||
362 | $! Delete The Object File. | ||
363 | $! | ||
364 | $ DELETE 'OBJ_DIR'RSAR_ERR.OBJ;* | ||
365 | $! | ||
366 | $! End The RSAREF Check. | ||
367 | $! | ||
368 | $ ENDIF | ||
369 | $! | ||
370 | $! Figure Out What Other Modules We Are To Build. | 273 | $! Figure Out What Other Modules We Are To Build. |
371 | $! | 274 | $! |
372 | $ BUILD_SET: | 275 | $ BUILD_SET: |
@@ -639,74 +542,34 @@ $! Tell the user what happens | |||
639 | $! | 542 | $! |
640 | $ WRITE SYS$OUTPUT " ",APPLICATION,".exe" | 543 | $ WRITE SYS$OUTPUT " ",APPLICATION,".exe" |
641 | $! | 544 | $! |
642 | $! Link The Program, Check To See If We Need To Link With RSAREF Or Not. | 545 | $! Link The Program. |
643 | $! | 546 | $! |
644 | $ ON ERROR THEN GOTO NEXT_APPLICATION | 547 | $ ON ERROR THEN GOTO NEXT_APPLICATION |
645 | $ IF (RSAREF.EQS."TRUE") | ||
646 | $ THEN | ||
647 | $! | 548 | $! |
648 | $! Check To See If We Are To Link With A Specific TCP/IP Library. | 549 | $! Check To See If We Are To Link With A Specific TCP/IP Library. |
649 | $! | 550 | $! |
650 | $ IF (TCPIP_LIB.NES."") | 551 | $ IF (TCPIP_LIB.NES."") |
651 | $ THEN | 552 | $ THEN |
652 | $! | ||
653 | $! Link With The RSAREF Library And A Specific TCP/IP Library. | ||
654 | $! | ||
655 | $ LINK/'DEBUGGER'/'TRACEBACK'/EXE='EXE_DIR''APPLICATION'.EXE - | ||
656 | 'OBJ_DIR''APPLICATION_OBJECTS', - | ||
657 | 'CRYPTO_LIB'/LIBRARY,'RSAREF_LIB'/LIBRARY, - | ||
658 | 'TCPIP_LIB','OPT_FILE'/OPTION | ||
659 | $! | ||
660 | $! Else... | ||
661 | $! | ||
662 | $ ELSE | ||
663 | $! | ||
664 | $! Link With The RSAREF Library And NO TCP/IP Library. | ||
665 | $! | 553 | $! |
666 | $ LINK/'DEBUGGER'/'TRACEBACK'/EXE='EXE_DIR''APPLICATION'.EXE - | 554 | $! Link With A TCP/IP Library. |
667 | 'OBJ_DIR''APPLICATION_OBJECTS', - | ||
668 | 'CRYPTO_LIB'/LIBRARY,'RSAREF_LIB'/LIBRARY, - | ||
669 | 'OPT_FILE'/OPTION | ||
670 | $! | 555 | $! |
671 | $! End The TCP/IP Library Check. | 556 | $ LINK/'DEBUGGER'/'TRACEBACK'/EXE='EXE_DIR''APPLICATION'.EXE - |
557 | 'OBJ_DIR''APPLICATION_OBJECTS', - | ||
558 | 'CRYPTO_LIB'/LIBRARY, - | ||
559 | 'TCPIP_LIB','OPT_FILE'/OPTION | ||
672 | $! | 560 | $! |
673 | $ ENDIF | 561 | $! Else... |
674 | $! | ||
675 | $! Else... | ||
676 | $! | 562 | $! |
677 | $ ELSE | 563 | $ ELSE |
678 | $! | 564 | $! |
679 | $! Don't Link With The RSAREF Routines. | 565 | $! Don't Link With A TCP/IP Library. |
680 | $! | ||
681 | $! | ||
682 | $! Check To See If We Are To Link With A Specific TCP/IP Library. | ||
683 | $! | ||
684 | $ IF (TCPIP_LIB.NES."") | ||
685 | $ THEN | ||
686 | $! | ||
687 | $! Don't Link With The RSAREF Routines And TCP/IP Library. | ||
688 | $! | ||
689 | $ LINK/'DEBUGGER'/'TRACEBACK'/EXE='EXE_DIR''APPLICATION'.EXE - | ||
690 | 'OBJ_DIR''APPLICATION_OBJECTS', - | ||
691 | 'CRYPTO_LIB'/LIBRARY, - | ||
692 | 'TCPIP_LIB','OPT_FILE'/OPTION | ||
693 | $! | ||
694 | $! Else... | ||
695 | $! | ||
696 | $ ELSE | ||
697 | $! | ||
698 | $! Don't Link With The RSAREF Routines And Link With A TCP/IP Library. | ||
699 | $! | ||
700 | $ LINK/'DEBUGGER'/'TRACEBACK'/EXE='EXE_DIR''APPLICATION'.EXE - | ||
701 | 'OBJ_DIR''APPLICATION_OBJECTS',- | ||
702 | 'CRYPTO_LIB'/LIBRARY, - | ||
703 | 'OPT_FILE'/OPTION | ||
704 | $! | 566 | $! |
705 | $! End The TCP/IP Library Check. | 567 | $ LINK/'DEBUGGER'/'TRACEBACK'/EXE='EXE_DIR''APPLICATION'.EXE - |
568 | 'OBJ_DIR''APPLICATION_OBJECTS',- | ||
569 | 'CRYPTO_LIB'/LIBRARY, - | ||
570 | 'OPT_FILE'/OPTION | ||
706 | $! | 571 | $! |
707 | $ ENDIF | 572 | $! End The TCP/IP Library Check. |
708 | $! | ||
709 | $! End The RSAREF Link Check. | ||
710 | $! | 573 | $! |
711 | $ ENDIF | 574 | $ ENDIF |
712 | $ GOTO NEXT_APPLICATION | 575 | $ GOTO NEXT_APPLICATION |
@@ -912,75 +775,10 @@ $ ENDIF | |||
912 | $! | 775 | $! |
913 | $! Check To See If P2 Is Blank. | 776 | $! Check To See If P2 Is Blank. |
914 | $! | 777 | $! |
915 | $ P2 = "NORSAREF" | 778 | $ IF (P2.EQS."NODEBUG") |
916 | $ IF (P2.EQS."NORSAREF") | ||
917 | $ THEN | 779 | $ THEN |
918 | $! | 780 | $! |
919 | $! P2 Is NORSAREF, So Compile With The Regular RSA Libraries. | 781 | $! P2 Is NODEBUG, So Compile Without The Debugger Information. |
920 | $! | ||
921 | $ RSAREF = "FALSE" | ||
922 | $ ELSE | ||
923 | $! | ||
924 | $! Check To See If We Are To Use The RSAREF Library. | ||
925 | $! | ||
926 | $ IF (P2.EQS."RSAREF") | ||
927 | $ THEN | ||
928 | $! | ||
929 | $! Check To Make Sure We Have The RSAREF Source Code Directory. | ||
930 | $! | ||
931 | $ IF (F$SEARCH("SYS$DISK:[-.RSAREF]SOURCE.DIR").EQS."") | ||
932 | $ THEN | ||
933 | $! | ||
934 | $! We Don't Have The RSAREF Souce Code Directory, So Tell The | ||
935 | $! User This. | ||
936 | $! | ||
937 | $ WRITE SYS$OUTPUT "" | ||
938 | $ WRITE SYS$OUTPUT "It appears that you don't have the RSAREF Souce Code." | ||
939 | $ WRITE SYS$OUTPUT "You need to go to 'ftp://ftp.rsa.com/rsaref'. You have to" | ||
940 | $ WRITE SYS$OUTPUT "get the '.tar-Z' file as the '.zip' file doesn't have the" | ||
941 | $ WRITE SYS$OUTPUT "directory structure stored. You have to extract the file" | ||
942 | $ WRITE SYS$OUTPUT "into the [.RSAREF] directory under the root directory" | ||
943 | $ WRITE SYS$OUTPUT "as that is where the scripts will look for the files." | ||
944 | $ WRITE SYS$OUTPUT "" | ||
945 | $! | ||
946 | $! Time To Exit. | ||
947 | $! | ||
948 | $ EXIT | ||
949 | $! | ||
950 | $! Else, Compile Using The RSAREF Library. | ||
951 | $! | ||
952 | $ ELSE | ||
953 | $ RSAREF = "TRUE" | ||
954 | $ ENDIF | ||
955 | $ ELSE | ||
956 | $! | ||
957 | $! They Entered An Invalid Option.. | ||
958 | $! | ||
959 | $ WRITE SYS$OUTPUT "" | ||
960 | $ WRITE SYS$OUTPUT "The Option ",P2," Is Invalid. The Valid Options Are:" | ||
961 | $ WRITE SYS$OUTPUT "" | ||
962 | $ WRITE SYS$OUTPUT " RSAREF : Compile With The RSAREF Library." | ||
963 | $ WRITE SYS$OUTPUT " NORSAREF : Compile With The Regular RSA Library." | ||
964 | $ WRITE SYS$OUTPUT "" | ||
965 | $! | ||
966 | $! Time To EXIT. | ||
967 | $! | ||
968 | $ EXIT | ||
969 | $! | ||
970 | $! End The Valid Arguement Check. | ||
971 | $! | ||
972 | $ ENDIF | ||
973 | $! | ||
974 | $! End The P2 Check. | ||
975 | $! | ||
976 | $ ENDIF | ||
977 | $! | ||
978 | $! Check To See If P3 Is Blank. | ||
979 | $! | ||
980 | $ IF (P3.EQS."NODEBUG") | ||
981 | $ THEN | ||
982 | $! | ||
983 | $! P3 Is NODEBUG, So Compile Without The Debugger Information. | ||
984 | $! | 782 | $! |
985 | $ DEBUGGER = "NODEBUG" | 783 | $ DEBUGGER = "NODEBUG" |
986 | $ TRACEBACK = "NOTRACEBACK" | 784 | $ TRACEBACK = "NOTRACEBACK" |
@@ -993,7 +791,7 @@ $ ELSE | |||
993 | $! | 791 | $! |
994 | $! Check To See If We Are To Compile With Debugger Information. | 792 | $! Check To See If We Are To Compile With Debugger Information. |
995 | $! | 793 | $! |
996 | $ IF (P3.EQS."DEBUG") | 794 | $ IF (P2.EQS."DEBUG") |
997 | $ THEN | 795 | $ THEN |
998 | $! | 796 | $! |
999 | $! Compile With Debugger Information. | 797 | $! Compile With Debugger Information. |
@@ -1010,7 +808,7 @@ $! | |||
1010 | $! They Entered An Invalid Option.. | 808 | $! They Entered An Invalid Option.. |
1011 | $! | 809 | $! |
1012 | $ WRITE SYS$OUTPUT "" | 810 | $ WRITE SYS$OUTPUT "" |
1013 | $ WRITE SYS$OUTPUT "The Option ",P3," Is Invalid. The Valid Options Are:" | 811 | $ WRITE SYS$OUTPUT "The Option ",P2," Is Invalid. The Valid Options Are:" |
1014 | $ WRITE SYS$OUTPUT "" | 812 | $ WRITE SYS$OUTPUT "" |
1015 | $ WRITE SYS$OUTPUT " DEBUG : Compile With The Debugger Information." | 813 | $ WRITE SYS$OUTPUT " DEBUG : Compile With The Debugger Information." |
1016 | $ WRITE SYS$OUTPUT " NODEBUG : Compile Without The Debugger Information." | 814 | $ WRITE SYS$OUTPUT " NODEBUG : Compile Without The Debugger Information." |
@@ -1024,7 +822,7 @@ $! End The Valid Arguement Check. | |||
1024 | $! | 822 | $! |
1025 | $ ENDIF | 823 | $ ENDIF |
1026 | $! | 824 | $! |
1027 | $! End The P3 Check. | 825 | $! End The P2 Check. |
1028 | $! | 826 | $! |
1029 | $ ENDIF | 827 | $ ENDIF |
1030 | $! | 828 | $! |
@@ -1034,9 +832,9 @@ $! Written By: Richard Levitte | |||
1034 | $! richard@levitte.org | 832 | $! richard@levitte.org |
1035 | $! | 833 | $! |
1036 | $! | 834 | $! |
1037 | $! Check To See If We Have A Option For P6. | 835 | $! Check To See If We Have A Option For P5. |
1038 | $! | 836 | $! |
1039 | $ IF (P6.EQS."") | 837 | $ IF (P5.EQS."") |
1040 | $ THEN | 838 | $ THEN |
1041 | $! | 839 | $! |
1042 | $! Get The Version Of VMS We Are Using. | 840 | $! Get The Version Of VMS We Are Using. |
@@ -1058,13 +856,13 @@ $! End The VMS Version Check. | |||
1058 | $! | 856 | $! |
1059 | $ ENDIF | 857 | $ ENDIF |
1060 | $! | 858 | $! |
1061 | $! End The P6 Check. | 859 | $! End The P5 Check. |
1062 | $! | 860 | $! |
1063 | $ ENDIF | 861 | $ ENDIF |
1064 | $! | 862 | $! |
1065 | $! Check To See If P4 Is Blank. | 863 | $! Check To See If P3 Is Blank. |
1066 | $! | 864 | $! |
1067 | $ IF (P4.EQS."") | 865 | $ IF (P3.EQS."") |
1068 | $ THEN | 866 | $ THEN |
1069 | $! | 867 | $! |
1070 | $! O.K., The User Didn't Specify A Compiler, Let's Try To | 868 | $! O.K., The User Didn't Specify A Compiler, Let's Try To |
@@ -1077,7 +875,7 @@ $ THEN | |||
1077 | $! | 875 | $! |
1078 | $! Looks Like GNUC, Set To Use GNUC. | 876 | $! Looks Like GNUC, Set To Use GNUC. |
1079 | $! | 877 | $! |
1080 | $ P4 = "GNUC" | 878 | $ P3 = "GNUC" |
1081 | $! | 879 | $! |
1082 | $! Else... | 880 | $! Else... |
1083 | $! | 881 | $! |
@@ -1090,7 +888,7 @@ $ THEN | |||
1090 | $! | 888 | $! |
1091 | $! Looks Like DECC, Set To Use DECC. | 889 | $! Looks Like DECC, Set To Use DECC. |
1092 | $! | 890 | $! |
1093 | $ P4 = "DECC" | 891 | $ P3 = "DECC" |
1094 | $! | 892 | $! |
1095 | $! Else... | 893 | $! Else... |
1096 | $! | 894 | $! |
@@ -1098,7 +896,7 @@ $ ELSE | |||
1098 | $! | 896 | $! |
1099 | $! Looks Like VAXC, Set To Use VAXC. | 897 | $! Looks Like VAXC, Set To Use VAXC. |
1100 | $! | 898 | $! |
1101 | $ P4 = "VAXC" | 899 | $ P3 = "VAXC" |
1102 | $! | 900 | $! |
1103 | $! End The VAXC Compiler Check. | 901 | $! End The VAXC Compiler Check. |
1104 | $! | 902 | $! |
@@ -1112,9 +910,9 @@ $! End The Compiler Check. | |||
1112 | $! | 910 | $! |
1113 | $ ENDIF | 911 | $ ENDIF |
1114 | $! | 912 | $! |
1115 | $! Check To See If We Have A Option For P5. | 913 | $! Check To See If We Have A Option For P4. |
1116 | $! | 914 | $! |
1117 | $ IF (P5.EQS."") | 915 | $ IF (P4.EQS."") |
1118 | $ THEN | 916 | $ THEN |
1119 | $! | 917 | $! |
1120 | $! Find out what socket library we have available | 918 | $! Find out what socket library we have available |
@@ -1124,7 +922,7 @@ $ THEN | |||
1124 | $! | 922 | $! |
1125 | $! We have SOCKETSHR, and it is my opinion that it's the best to use. | 923 | $! We have SOCKETSHR, and it is my opinion that it's the best to use. |
1126 | $! | 924 | $! |
1127 | $ P5 = "SOCKETSHR" | 925 | $ P4 = "SOCKETSHR" |
1128 | $! | 926 | $! |
1129 | $! Tell the user | 927 | $! Tell the user |
1130 | $! | 928 | $! |
@@ -1144,7 +942,7 @@ $ THEN | |||
1144 | $! | 942 | $! |
1145 | $! Last resort: a UCX or UCX-compatible library | 943 | $! Last resort: a UCX or UCX-compatible library |
1146 | $! | 944 | $! |
1147 | $ P5 = "UCX" | 945 | $ P4 = "UCX" |
1148 | $! | 946 | $! |
1149 | $! Tell the user | 947 | $! Tell the user |
1150 | $! | 948 | $! |
@@ -1158,7 +956,7 @@ $ ENDIF | |||
1158 | $! | 956 | $! |
1159 | $! Set Up Initial CC Definitions, Possibly With User Ones | 957 | $! Set Up Initial CC Definitions, Possibly With User Ones |
1160 | $! | 958 | $! |
1161 | $ CCDEFS = "TCPIP_TYPE_''P5',DSO_VMS" | 959 | $ CCDEFS = "TCPIP_TYPE_''P4',DSO_VMS" |
1162 | $ IF F$TYPE(USER_CCDEFS) .NES. "" THEN CCDEFS = CCDEFS + "," + USER_CCDEFS | 960 | $ IF F$TYPE(USER_CCDEFS) .NES. "" THEN CCDEFS = CCDEFS + "," + USER_CCDEFS |
1163 | $ CCEXTRAFLAGS = "" | 961 | $ CCEXTRAFLAGS = "" |
1164 | $ IF F$TYPE(USER_CCFLAGS) .NES. "" THEN CCEXTRAFLAGS = USER_CCFLAGS | 962 | $ IF F$TYPE(USER_CCFLAGS) .NES. "" THEN CCEXTRAFLAGS = USER_CCFLAGS |
@@ -1168,12 +966,12 @@ $ IF F$TYPE(USER_CCDISABLEWARNINGS) .NES. "" THEN - | |||
1168 | $! | 966 | $! |
1169 | $! Check To See If The User Entered A Valid Paramter. | 967 | $! Check To See If The User Entered A Valid Paramter. |
1170 | $! | 968 | $! |
1171 | $ IF (P4.EQS."VAXC").OR.(P4.EQS."DECC").OR.(P4.EQS."GNUC") | 969 | $ IF (P3.EQS."VAXC").OR.(P3.EQS."DECC").OR.(P3.EQS."GNUC") |
1172 | $ THEN | 970 | $ THEN |
1173 | $! | 971 | $! |
1174 | $! Check To See If The User Wanted DECC. | 972 | $! Check To See If The User Wanted DECC. |
1175 | $! | 973 | $! |
1176 | $ IF (P4.EQS."DECC") | 974 | $ IF (P3.EQS."DECC") |
1177 | $ THEN | 975 | $ THEN |
1178 | $! | 976 | $! |
1179 | $! Looks Like DECC, Set To Use DECC. | 977 | $! Looks Like DECC, Set To Use DECC. |
@@ -1204,7 +1002,7 @@ $ ENDIF | |||
1204 | $! | 1002 | $! |
1205 | $! Check To See If We Are To Use VAXC. | 1003 | $! Check To See If We Are To Use VAXC. |
1206 | $! | 1004 | $! |
1207 | $ IF (P4.EQS."VAXC") | 1005 | $ IF (P3.EQS."VAXC") |
1208 | $ THEN | 1006 | $ THEN |
1209 | $! | 1007 | $! |
1210 | $! Looks Like VAXC, Set To Use VAXC. | 1008 | $! Looks Like VAXC, Set To Use VAXC. |
@@ -1243,7 +1041,7 @@ $ ENDIF | |||
1243 | $! | 1041 | $! |
1244 | $! Check To See If We Are To Use GNU C. | 1042 | $! Check To See If We Are To Use GNU C. |
1245 | $! | 1043 | $! |
1246 | $ IF (P4.EQS."GNUC") | 1044 | $ IF (P3.EQS."GNUC") |
1247 | $ THEN | 1045 | $ THEN |
1248 | $! | 1046 | $! |
1249 | $! Looks Like GNUC, Set To Use GNUC. | 1047 | $! Looks Like GNUC, Set To Use GNUC. |
@@ -1272,31 +1070,6 @@ $! Set up default defines | |||
1272 | $! | 1070 | $! |
1273 | $ CCDEFS = """FLAT_INC=1""," + CCDEFS | 1071 | $ CCDEFS = """FLAT_INC=1""," + CCDEFS |
1274 | $! | 1072 | $! |
1275 | $! Check To See If We Are To Compile With RSAREF Routines. | ||
1276 | $! | ||
1277 | $ IF (RSAREF.EQS."TRUE") | ||
1278 | $ THEN | ||
1279 | $! | ||
1280 | $! Compile With RSAREF. | ||
1281 | $! | ||
1282 | $ CCDEFS = CCDEFS + ",""RSAref=1""" | ||
1283 | $! | ||
1284 | $! Tell The User This. | ||
1285 | $! | ||
1286 | $ WRITE SYS$OUTPUT "Compiling With RSAREF Routines." | ||
1287 | $! | ||
1288 | $! Else, We Don't Care. Compile Without The RSAREF Library. | ||
1289 | $! | ||
1290 | $ ELSE | ||
1291 | $! | ||
1292 | $! Tell The User We Are Compile Without The RSAREF Routines. | ||
1293 | $! | ||
1294 | $ WRITE SYS$OUTPUT "Compiling Without The RSAREF Routines. | ||
1295 | $! | ||
1296 | $! End The RSAREF Check. | ||
1297 | $! | ||
1298 | $ ENDIF | ||
1299 | $! | ||
1300 | $! Finish up the definition of CC. | 1073 | $! Finish up the definition of CC. |
1301 | $! | 1074 | $! |
1302 | $ IF COMPILER .EQS. "DECC" | 1075 | $ IF COMPILER .EQS. "DECC" |
@@ -1315,7 +1088,7 @@ $ CC4DISABLEWARNINGS = "" | |||
1315 | $ ENDIF | 1088 | $ ENDIF |
1316 | $ CC3 = CC + "/DEFINE=(" + CCDEFS + ISSEVEN + ")" + CCDISABLEWARNINGS | 1089 | $ CC3 = CC + "/DEFINE=(" + CCDEFS + ISSEVEN + ")" + CCDISABLEWARNINGS |
1317 | $ CC = CC + "/DEFINE=(" + CCDEFS + ")" + CCDISABLEWARNINGS | 1090 | $ CC = CC + "/DEFINE=(" + CCDEFS + ")" + CCDISABLEWARNINGS |
1318 | $ IF ARCH .EQS. "VAX" .AND. COMPILER .EQS. "DECC" .AND. P3 .NES. "DEBUG" | 1091 | $ IF ARCH .EQS. "VAX" .AND. COMPILER .EQS. "DECC" .AND. P2 .NES. "DEBUG" |
1319 | $ THEN | 1092 | $ THEN |
1320 | $ CC5 = CC + "/OPTIMIZE=NODISJOINT" | 1093 | $ CC5 = CC + "/OPTIMIZE=NODISJOINT" |
1321 | $ ELSE | 1094 | $ ELSE |
@@ -1334,7 +1107,7 @@ $! | |||
1334 | $! Tell The User We Don't Know What They Want. | 1107 | $! Tell The User We Don't Know What They Want. |
1335 | $! | 1108 | $! |
1336 | $ WRITE SYS$OUTPUT "" | 1109 | $ WRITE SYS$OUTPUT "" |
1337 | $ WRITE SYS$OUTPUT "The Option ",P4," Is Invalid. The Valid Options Are:" | 1110 | $ WRITE SYS$OUTPUT "The Option ",P3," Is Invalid. The Valid Options Are:" |
1338 | $ WRITE SYS$OUTPUT "" | 1111 | $ WRITE SYS$OUTPUT "" |
1339 | $ WRITE SYS$OUTPUT " VAXC : To Compile With VAX C." | 1112 | $ WRITE SYS$OUTPUT " VAXC : To Compile With VAX C." |
1340 | $ WRITE SYS$OUTPUT " DECC : To Compile With DEC C." | 1113 | $ WRITE SYS$OUTPUT " DECC : To Compile With DEC C." |
@@ -1360,13 +1133,13 @@ $ WRITE/SYMBOL SYS$OUTPUT "Main MACRO Compiling Command: ",MACRO | |||
1360 | $! | 1133 | $! |
1361 | $! Time to check the contents, and to make sure we get the correct library. | 1134 | $! Time to check the contents, and to make sure we get the correct library. |
1362 | $! | 1135 | $! |
1363 | $ IF P5.EQS."SOCKETSHR" .OR. P5.EQS."MULTINET" .OR. P5.EQS."UCX" - | 1136 | $ IF P4.EQS."SOCKETSHR" .OR. P4.EQS."MULTINET" .OR. P4.EQS."UCX" - |
1364 | .OR. P5.EQS."TCPIP" .OR. P5.EQS."NONE" | 1137 | .OR. P4.EQS."TCPIP" .OR. P4.EQS."NONE" |
1365 | $ THEN | 1138 | $ THEN |
1366 | $! | 1139 | $! |
1367 | $! Check to see if SOCKETSHR was chosen | 1140 | $! Check to see if SOCKETSHR was chosen |
1368 | $! | 1141 | $! |
1369 | $ IF P5.EQS."SOCKETSHR" | 1142 | $ IF P4.EQS."SOCKETSHR" |
1370 | $ THEN | 1143 | $ THEN |
1371 | $! | 1144 | $! |
1372 | $! Set the library to use SOCKETSHR | 1145 | $! Set the library to use SOCKETSHR |
@@ -1379,12 +1152,12 @@ $ ENDIF | |||
1379 | $! | 1152 | $! |
1380 | $! Check to see if MULTINET was chosen | 1153 | $! Check to see if MULTINET was chosen |
1381 | $! | 1154 | $! |
1382 | $ IF P5.EQS."MULTINET" | 1155 | $ IF P4.EQS."MULTINET" |
1383 | $ THEN | 1156 | $ THEN |
1384 | $! | 1157 | $! |
1385 | $! Set the library to use UCX emulation. | 1158 | $! Set the library to use UCX emulation. |
1386 | $! | 1159 | $! |
1387 | $ P5 = "UCX" | 1160 | $ P4 = "UCX" |
1388 | $! | 1161 | $! |
1389 | $! Done with MULTINET | 1162 | $! Done with MULTINET |
1390 | $! | 1163 | $! |
@@ -1392,7 +1165,7 @@ $ ENDIF | |||
1392 | $! | 1165 | $! |
1393 | $! Check to see if UCX was chosen | 1166 | $! Check to see if UCX was chosen |
1394 | $! | 1167 | $! |
1395 | $ IF P5.EQS."UCX" | 1168 | $ IF P4.EQS."UCX" |
1396 | $ THEN | 1169 | $ THEN |
1397 | $! | 1170 | $! |
1398 | $! Set the library to use UCX. | 1171 | $! Set the library to use UCX. |
@@ -1412,7 +1185,7 @@ $ ENDIF | |||
1412 | $! | 1185 | $! |
1413 | $! Check to see if TCPIP was chosen | 1186 | $! Check to see if TCPIP was chosen |
1414 | $! | 1187 | $! |
1415 | $ IF P5.EQS."TCPIP" | 1188 | $ IF P4.EQS."TCPIP" |
1416 | $ THEN | 1189 | $ THEN |
1417 | $! | 1190 | $! |
1418 | $! Set the library to use TCPIP (post UCX). | 1191 | $! Set the library to use TCPIP (post UCX). |
@@ -1425,7 +1198,7 @@ $ ENDIF | |||
1425 | $! | 1198 | $! |
1426 | $! Check to see if NONE was chosen | 1199 | $! Check to see if NONE was chosen |
1427 | $! | 1200 | $! |
1428 | $ IF P5.EQS."NONE" | 1201 | $ IF P4.EQS."NONE" |
1429 | $ THEN | 1202 | $ THEN |
1430 | $! | 1203 | $! |
1431 | $! Do not use a TCPIP library. | 1204 | $! Do not use a TCPIP library. |
@@ -1447,7 +1220,7 @@ $! | |||
1447 | $! Tell The User We Don't Know What They Want. | 1220 | $! Tell The User We Don't Know What They Want. |
1448 | $! | 1221 | $! |
1449 | $ WRITE SYS$OUTPUT "" | 1222 | $ WRITE SYS$OUTPUT "" |
1450 | $ WRITE SYS$OUTPUT "The Option ",P5," Is Invalid. The Valid Options Are:" | 1223 | $ WRITE SYS$OUTPUT "The Option ",P4," Is Invalid. The Valid Options Are:" |
1451 | $ WRITE SYS$OUTPUT "" | 1224 | $ WRITE SYS$OUTPUT "" |
1452 | $ WRITE SYS$OUTPUT " SOCKETSHR : To link with SOCKETSHR TCP/IP library." | 1225 | $ WRITE SYS$OUTPUT " SOCKETSHR : To link with SOCKETSHR TCP/IP library." |
1453 | $ WRITE SYS$OUTPUT " UCX : To link with UCX TCP/IP library." | 1226 | $ WRITE SYS$OUTPUT " UCX : To link with UCX TCP/IP library." |
@@ -1465,10 +1238,9 @@ $! | |||
1465 | $! Check if the user wanted to compile just a subset of all the encryption | 1238 | $! Check if the user wanted to compile just a subset of all the encryption |
1466 | $! methods. | 1239 | $! methods. |
1467 | $! | 1240 | $! |
1468 | $ IF P7 .NES. "" | 1241 | $ IF P6 .NES. "" |
1469 | $ THEN | 1242 | $ THEN |
1470 | $ ENCRYPT_TYPES = P7 | 1243 | $ ENCRYPT_TYPES = P6 |
1471 | $! NYI: ENCRYPT_PROGRAMS = P7 | ||
1472 | $ ENDIF | 1244 | $ ENDIF |
1473 | $! | 1245 | $! |
1474 | $! Time To RETURN... | 1246 | $! Time To RETURN... |
diff --git a/src/lib/libcrypto/des/FILES0 b/src/lib/libcrypto/des/FILES0 new file mode 100644 index 0000000000..4c7ea2de7a --- /dev/null +++ b/src/lib/libcrypto/des/FILES0 | |||
@@ -0,0 +1,96 @@ | |||
1 | /* General stuff */ | ||
2 | COPYRIGHT - Copyright info. | ||
3 | MODES.DES - A description of the features of the different modes of DES. | ||
4 | FILES - This file. | ||
5 | INSTALL - How to make things compile. | ||
6 | Imakefile - For use with kerberos. | ||
7 | README - What this package is. | ||
8 | VERSION - Which version this is and what was changed. | ||
9 | KERBEROS - Kerberos version 4 notes. | ||
10 | Makefile.PL - An old makefile to build with perl5, not current. | ||
11 | Makefile.ssl - The SSLeay makefile | ||
12 | Makefile.uni - The normal unix makefile. | ||
13 | GNUmakefile - The makefile for use with glibc. | ||
14 | makefile.bc - A Borland C makefile | ||
15 | times - Some outputs from 'speed' on some machines. | ||
16 | vms.com - For use when compiling under VMS | ||
17 | |||
18 | /* My SunOS des(1) replacement */ | ||
19 | des.c - des(1) source code. | ||
20 | des.man - des(1) manual. | ||
21 | |||
22 | /* Testing and timing programs. */ | ||
23 | destest.c - Source for libdes.a test program. | ||
24 | speed.c - Source for libdes.a timing program. | ||
25 | rpw.c - Source for libdes.a testing password reading routines. | ||
26 | |||
27 | /* libdes.a source code */ | ||
28 | des_crypt.man - libdes.a manual page. | ||
29 | des.h - Public libdes.a header file. | ||
30 | ecb_enc.c - des_ecb_encrypt() source, this contains the basic DES code. | ||
31 | ecb3_enc.c - des_ecb3_encrypt() source. | ||
32 | cbc_ckm.c - des_cbc_cksum() source. | ||
33 | cbc_enc.c - des_cbc_encrypt() source. | ||
34 | ncbc_enc.c - des_cbc_encrypt() that is 'normal' in that it copies | ||
35 | the new iv values back in the passed iv vector. | ||
36 | ede_enc.c - des_ede3_cbc_encrypt() cbc mode des using triple DES. | ||
37 | cbc3_enc.c - des_3cbc_encrypt() source, don't use this function. | ||
38 | cfb_enc.c - des_cfb_encrypt() source. | ||
39 | cfb64enc.c - des_cfb64_encrypt() cfb in 64 bit mode but setup to be | ||
40 | used as a stream cipher. | ||
41 | cfb64ede.c - des_ede3_cfb64_encrypt() cfb in 64 bit mode but setup to be | ||
42 | used as a stream cipher and using triple DES. | ||
43 | ofb_enc.c - des_cfb_encrypt() source. | ||
44 | ofb64_enc.c - des_ofb_encrypt() ofb in 64 bit mode but setup to be | ||
45 | used as a stream cipher. | ||
46 | ofb64ede.c - des_ede3_ofb64_encrypt() ofb in 64 bit mode but setup to be | ||
47 | used as a stream cipher and using triple DES. | ||
48 | enc_read.c - des_enc_read() source. | ||
49 | enc_writ.c - des_enc_write() source. | ||
50 | pcbc_enc.c - des_pcbc_encrypt() source. | ||
51 | qud_cksm.c - quad_cksum() source. | ||
52 | rand_key.c - des_random_key() source. | ||
53 | read_pwd.c - Source for des_read_password() plus related functions. | ||
54 | set_key.c - Source for des_set_key(). | ||
55 | str2key.c - Covert a string of any length into a key. | ||
56 | fcrypt.c - A small, fast version of crypt(3). | ||
57 | des_locl.h - Internal libdes.a header file. | ||
58 | podd.h - Odd parity tables - used in des_set_key(). | ||
59 | sk.h - Lookup tables used in des_set_key(). | ||
60 | spr.h - What is left of the S tables - used in ecb_encrypt(). | ||
61 | des_ver.h - header file for the external definition of the | ||
62 | version string. | ||
63 | des.doc - SSLeay documentation for the library. | ||
64 | |||
65 | /* The perl scripts - you can ignore these files they are only | ||
66 | * included for the curious */ | ||
67 | des.pl - des in perl anyone? des_set_key and des_ecb_encrypt | ||
68 | both done in a perl library. | ||
69 | testdes.pl - Testing program for des.pl | ||
70 | doIP - Perl script used to develop IP xor/shift code. | ||
71 | doPC1 - Perl script used to develop PC1 xor/shift code. | ||
72 | doPC2 - Generates sk.h. | ||
73 | PC1 - Output of doPC1 should be the same as output from PC1. | ||
74 | PC2 - used in development of doPC2. | ||
75 | shifts.pl - Perl library used by my perl scripts. | ||
76 | |||
77 | /* I started making a perl5 dynamic library for libdes | ||
78 | * but did not fully finish, these files are part of that effort. */ | ||
79 | DES.pm | ||
80 | DES.pod | ||
81 | DES.xs | ||
82 | t | ||
83 | typemap | ||
84 | |||
85 | /* The following are for use with sun RPC implementaions. */ | ||
86 | rpc_des.h | ||
87 | rpc_enc.c | ||
88 | |||
89 | /* The following are contibuted by Mark Murray <mark@grondar.za>. They | ||
90 | * are not normally built into libdes due to machine specific routines | ||
91 | * contained in them. They are for use in the most recent incarnation of | ||
92 | * export kerberos v 4 (eBones). */ | ||
93 | supp.c | ||
94 | new_rkey.c | ||
95 | |||
96 | |||
diff --git a/src/lib/libcrypto/des/des.c b/src/lib/libcrypto/des/des.c index d8c846b23d..343135ff9e 100644 --- a/src/lib/libcrypto/des/des.c +++ b/src/lib/libcrypto/des/des.c | |||
@@ -427,7 +427,7 @@ void doencryption(void) | |||
427 | k2[i-8]=k; | 427 | k2[i-8]=k; |
428 | } | 428 | } |
429 | DES_set_key_unchecked(&k2,&ks2); | 429 | DES_set_key_unchecked(&k2,&ks2); |
430 | memset(k2,0,sizeof(k2)); | 430 | OPENSSL_cleanse(k2,sizeof(k2)); |
431 | } | 431 | } |
432 | else if (longk || flag3) | 432 | else if (longk || flag3) |
433 | { | 433 | { |
@@ -435,7 +435,7 @@ void doencryption(void) | |||
435 | { | 435 | { |
436 | DES_string_to_2keys(key,&kk,&k2); | 436 | DES_string_to_2keys(key,&kk,&k2); |
437 | DES_set_key_unchecked(&k2,&ks2); | 437 | DES_set_key_unchecked(&k2,&ks2); |
438 | memset(k2,0,sizeof(k2)); | 438 | OPENSSL_cleanse(k2,sizeof(k2)); |
439 | } | 439 | } |
440 | else | 440 | else |
441 | DES_string_to_key(key,&kk); | 441 | DES_string_to_key(key,&kk); |
@@ -457,8 +457,8 @@ void doencryption(void) | |||
457 | } | 457 | } |
458 | 458 | ||
459 | DES_set_key_unchecked(&kk,&ks); | 459 | DES_set_key_unchecked(&kk,&ks); |
460 | memset(key,0,sizeof(key)); | 460 | OPENSSL_cleanse(key,sizeof(key)); |
461 | memset(kk,0,sizeof(kk)); | 461 | OPENSSL_cleanse(kk,sizeof(kk)); |
462 | /* woops - A bug that does not showup under unix :-( */ | 462 | /* woops - A bug that does not showup under unix :-( */ |
463 | memset(iv,0,sizeof(iv)); | 463 | memset(iv,0,sizeof(iv)); |
464 | memset(iv2,0,sizeof(iv2)); | 464 | memset(iv2,0,sizeof(iv2)); |
@@ -666,18 +666,18 @@ void doencryption(void) | |||
666 | if (l) fclose(CKSUM_OUT); | 666 | if (l) fclose(CKSUM_OUT); |
667 | } | 667 | } |
668 | problems: | 668 | problems: |
669 | memset(buf,0,sizeof(buf)); | 669 | OPENSSL_cleanse(buf,sizeof(buf)); |
670 | memset(obuf,0,sizeof(obuf)); | 670 | OPENSSL_cleanse(obuf,sizeof(obuf)); |
671 | memset(&ks,0,sizeof(ks)); | 671 | OPENSSL_cleanse(&ks,sizeof(ks)); |
672 | memset(&ks2,0,sizeof(ks2)); | 672 | OPENSSL_cleanse(&ks2,sizeof(ks2)); |
673 | memset(iv,0,sizeof(iv)); | 673 | OPENSSL_cleanse(iv,sizeof(iv)); |
674 | memset(iv2,0,sizeof(iv2)); | 674 | OPENSSL_cleanse(iv2,sizeof(iv2)); |
675 | memset(kk,0,sizeof(kk)); | 675 | OPENSSL_cleanse(kk,sizeof(kk)); |
676 | memset(k2,0,sizeof(k2)); | 676 | OPENSSL_cleanse(k2,sizeof(k2)); |
677 | memset(uubuf,0,sizeof(uubuf)); | 677 | OPENSSL_cleanse(uubuf,sizeof(uubuf)); |
678 | memset(b,0,sizeof(b)); | 678 | OPENSSL_cleanse(b,sizeof(b)); |
679 | memset(bb,0,sizeof(bb)); | 679 | OPENSSL_cleanse(bb,sizeof(bb)); |
680 | memset(cksum,0,sizeof(cksum)); | 680 | OPENSSL_cleanse(cksum,sizeof(cksum)); |
681 | if (Exit) EXIT(Exit); | 681 | if (Exit) EXIT(Exit); |
682 | } | 682 | } |
683 | 683 | ||
diff --git a/src/lib/libcrypto/des/des_old.h b/src/lib/libcrypto/des/des_old.h index 51b987422a..1d840b474a 100644 --- a/src/lib/libcrypto/des/des_old.h +++ b/src/lib/libcrypto/des/des_old.h | |||
@@ -88,14 +88,14 @@ | |||
88 | * | 88 | * |
89 | */ | 89 | */ |
90 | 90 | ||
91 | #ifndef HEADER_DES_OLD_H | 91 | #ifndef HEADER_DES_H |
92 | #define HEADER_DES_OLD_H | 92 | #define HEADER_DES_H |
93 | 93 | ||
94 | #ifdef OPENSSL_NO_DES | 94 | #ifdef OPENSSL_NO_DES |
95 | #error DES is disabled. | 95 | #error DES is disabled. |
96 | #endif | 96 | #endif |
97 | 97 | ||
98 | #ifndef HEADER_DES_H | 98 | #ifndef HEADER_NEW_DES_H |
99 | #error You must include des.h, not des_old.h directly. | 99 | #error You must include des.h, not des_old.h directly. |
100 | #endif | 100 | #endif |
101 | 101 | ||
@@ -173,10 +173,12 @@ typedef struct _ossl_old_des_ks_struct | |||
173 | DES_fcrypt((b),(s),(r)) | 173 | DES_fcrypt((b),(s),(r)) |
174 | #define des_crypt(b,s)\ | 174 | #define des_crypt(b,s)\ |
175 | DES_crypt((b),(s)) | 175 | DES_crypt((b),(s)) |
176 | #if 0 | ||
176 | #if !defined(PERL5) && !defined(__FreeBSD__) && !defined(NeXT) && !defined(__OpenBSD__) | 177 | #if !defined(PERL5) && !defined(__FreeBSD__) && !defined(NeXT) && !defined(__OpenBSD__) |
177 | #define crypt(b,s)\ | 178 | #define crypt(b,s)\ |
178 | DES_crypt((b),(s)) | 179 | DES_crypt((b),(s)) |
179 | #endif | 180 | #endif |
181 | #endif | ||
180 | #define des_ofb_encrypt(i,o,n,l,k,iv)\ | 182 | #define des_ofb_encrypt(i,o,n,l,k,iv)\ |
181 | DES_ofb_encrypt((i),(o),(n),(l),&(k),(iv)) | 183 | DES_ofb_encrypt((i),(o),(n),(l),&(k),(iv)) |
182 | #define des_pcbc_encrypt(i,o,l,k,iv,e)\ | 184 | #define des_pcbc_encrypt(i,o,l,k,iv,e)\ |
@@ -274,8 +276,10 @@ typedef struct _ossl_old_des_ks_struct | |||
274 | _ossl_old_des_fcrypt((b),(s),(r)) | 276 | _ossl_old_des_fcrypt((b),(s),(r)) |
275 | #define des_crypt(b,s)\ | 277 | #define des_crypt(b,s)\ |
276 | _ossl_old_des_crypt((b),(s)) | 278 | _ossl_old_des_crypt((b),(s)) |
279 | #if 0 | ||
277 | #define crypt(b,s)\ | 280 | #define crypt(b,s)\ |
278 | _ossl_old_crypt((b),(s)) | 281 | _ossl_old_crypt((b),(s)) |
282 | #endif | ||
279 | #define des_ofb_encrypt(i,o,n,l,k,iv)\ | 283 | #define des_ofb_encrypt(i,o,n,l,k,iv)\ |
280 | _ossl_old_des_ofb_encrypt((i),(o),(n),(l),(k),(iv)) | 284 | _ossl_old_des_ofb_encrypt((i),(o),(n),(l),(k),(iv)) |
281 | #define des_pcbc_encrypt(i,o,l,k,iv,e)\ | 285 | #define des_pcbc_encrypt(i,o,l,k,iv,e)\ |
diff --git a/src/lib/libcrypto/des/destest.c b/src/lib/libcrypto/des/destest.c index 58e8c35dcb..687c00c792 100644 --- a/src/lib/libcrypto/des/destest.c +++ b/src/lib/libcrypto/des/destest.c | |||
@@ -84,9 +84,7 @@ int main(int argc, char *argv[]) | |||
84 | #else | 84 | #else |
85 | #include <openssl/des.h> | 85 | #include <openssl/des.h> |
86 | 86 | ||
87 | #if defined(PERL5) || defined(__FreeBSD__) || defined(NeXT) | ||
88 | #define crypt(c,s) (des_crypt((c),(s))) | 87 | #define crypt(c,s) (des_crypt((c),(s))) |
89 | #endif | ||
90 | 88 | ||
91 | /* tisk tisk - the test keys don't all have odd parity :-( */ | 89 | /* tisk tisk - the test keys don't all have odd parity :-( */ |
92 | /* test data */ | 90 | /* test data */ |
@@ -322,7 +320,11 @@ static unsigned char ofb_cipher[24]= | |||
322 | 0x3d,0x6d,0x5b,0xe3,0x25,0x5a,0xf8,0xc3 | 320 | 0x3d,0x6d,0x5b,0xe3,0x25,0x5a,0xf8,0xc3 |
323 | }; | 321 | }; |
324 | 322 | ||
323 | #if 0 | ||
325 | static DES_LONG cbc_cksum_ret=0xB462FEF7L; | 324 | static DES_LONG cbc_cksum_ret=0xB462FEF7L; |
325 | #else | ||
326 | static DES_LONG cbc_cksum_ret=0xF7FE62B4L; | ||
327 | #endif | ||
326 | static unsigned char cbc_cksum_data[8]={0x1D,0x26,0x93,0x97,0xf7,0xfe,0x62,0xb4}; | 328 | static unsigned char cbc_cksum_data[8]={0x1D,0x26,0x93,0x97,0xf7,0xfe,0x62,0xb4}; |
327 | 329 | ||
328 | static char *pt(unsigned char *p); | 330 | static char *pt(unsigned char *p); |
diff --git a/src/lib/libcrypto/des/read2pwd.c b/src/lib/libcrypto/des/read2pwd.c index b4720c3a98..3a63c4016c 100644 --- a/src/lib/libcrypto/des/read2pwd.c +++ b/src/lib/libcrypto/des/read2pwd.c | |||
@@ -120,8 +120,8 @@ int DES_read_password(DES_cblock *key, const char *prompt, int verify) | |||
120 | 120 | ||
121 | if ((ok=UI_UTIL_read_pw(buf,buff,BUFSIZ,prompt,verify)) == 0) | 121 | if ((ok=UI_UTIL_read_pw(buf,buff,BUFSIZ,prompt,verify)) == 0) |
122 | DES_string_to_key(buf,key); | 122 | DES_string_to_key(buf,key); |
123 | memset(buf,0,BUFSIZ); | 123 | OPENSSL_cleanse(buf,BUFSIZ); |
124 | memset(buff,0,BUFSIZ); | 124 | OPENSSL_cleanse(buff,BUFSIZ); |
125 | return(ok); | 125 | return(ok); |
126 | } | 126 | } |
127 | 127 | ||
@@ -133,7 +133,7 @@ int DES_read_2passwords(DES_cblock *key1, DES_cblock *key2, const char *prompt, | |||
133 | 133 | ||
134 | if ((ok=UI_UTIL_read_pw(buf,buff,BUFSIZ,prompt,verify)) == 0) | 134 | if ((ok=UI_UTIL_read_pw(buf,buff,BUFSIZ,prompt,verify)) == 0) |
135 | DES_string_to_2keys(buf,key1,key2); | 135 | DES_string_to_2keys(buf,key1,key2); |
136 | memset(buf,0,BUFSIZ); | 136 | OPENSSL_cleanse(buf,BUFSIZ); |
137 | memset(buff,0,BUFSIZ); | 137 | OPENSSL_cleanse(buff,BUFSIZ); |
138 | return(ok); | 138 | return(ok); |
139 | } | 139 | } |
diff --git a/src/lib/libcrypto/des/read_pwd.c b/src/lib/libcrypto/des/read_pwd.c index 9061935f21..ce5fa00a37 100644 --- a/src/lib/libcrypto/des/read_pwd.c +++ b/src/lib/libcrypto/des/read_pwd.c | |||
@@ -101,8 +101,10 @@ | |||
101 | 101 | ||
102 | #ifdef WIN_CONSOLE_BUG | 102 | #ifdef WIN_CONSOLE_BUG |
103 | #include <windows.h> | 103 | #include <windows.h> |
104 | #ifndef OPENSSL_SYS_WINCE | ||
104 | #include <wincon.h> | 105 | #include <wincon.h> |
105 | #endif | 106 | #endif |
107 | #endif | ||
106 | 108 | ||
107 | 109 | ||
108 | /* There are 5 types of terminal interface supported, | 110 | /* There are 5 types of terminal interface supported, |
@@ -133,7 +135,7 @@ | |||
133 | #define SGTTY | 135 | #define SGTTY |
134 | #endif | 136 | #endif |
135 | 137 | ||
136 | #if defined(OPENSSL_SYS_VSWORKS) | 138 | #if defined(OPENSSL_SYS_VXWORKS) |
137 | #undef TERMIOS | 139 | #undef TERMIOS |
138 | #undef TERMIO | 140 | #undef TERMIO |
139 | #undef SGTTY | 141 | #undef SGTTY |
@@ -167,7 +169,7 @@ | |||
167 | #include <sys/ioctl.h> | 169 | #include <sys/ioctl.h> |
168 | #endif | 170 | #endif |
169 | 171 | ||
170 | #if defined(OPENSSL_SYS_MSDOS) && !defined(__CYGWIN32__) | 172 | #if defined(OPENSSL_SYS_MSDOS) && !defined(__CYGWIN32__) && !defined(OPENSSL_SYS_WINCE) |
171 | #include <conio.h> | 173 | #include <conio.h> |
172 | #define fgets(a,b,c) noecho_fgets(a,b,c) | 174 | #define fgets(a,b,c) noecho_fgets(a,b,c) |
173 | #endif | 175 | #endif |
@@ -218,11 +220,29 @@ int des_read_pw_string(char *buf, int length, const char *prompt, | |||
218 | int ret; | 220 | int ret; |
219 | 221 | ||
220 | ret=des_read_pw(buf,buff,(length>BUFSIZ)?BUFSIZ:length,prompt,verify); | 222 | ret=des_read_pw(buf,buff,(length>BUFSIZ)?BUFSIZ:length,prompt,verify); |
221 | memset(buff,0,BUFSIZ); | 223 | OPENSSL_cleanse(buff,BUFSIZ); |
222 | return(ret); | 224 | return(ret); |
223 | } | 225 | } |
224 | 226 | ||
225 | #ifndef OPENSSL_SYS_WIN16 | 227 | #ifdef OPENSSL_SYS_WINCE |
228 | |||
229 | int des_read_pw(char *buf, char *buff, int size, const char *prompt, int verify) | ||
230 | { | ||
231 | memset(buf,0,size); | ||
232 | memset(buff,0,size); | ||
233 | return(0); | ||
234 | } | ||
235 | |||
236 | #elif defined(OPENSSL_SYS_WIN16) | ||
237 | |||
238 | int des_read_pw(char *buf, char *buff, int size, char *prompt, int verify) | ||
239 | { | ||
240 | memset(buf,0,size); | ||
241 | memset(buff,0,size); | ||
242 | return(0); | ||
243 | } | ||
244 | |||
245 | #else /* !OPENSSL_SYS_WINCE && !OPENSSL_SYS_WIN16 */ | ||
226 | 246 | ||
227 | static void read_till_nl(FILE *in) | 247 | static void read_till_nl(FILE *in) |
228 | { | 248 | { |
@@ -274,7 +294,7 @@ int des_read_pw(char *buf, char *buff, int size, const char *prompt, | |||
274 | #ifdef OPENSSL_SYS_MSDOS | 294 | #ifdef OPENSSL_SYS_MSDOS |
275 | if ((tty=fopen("con","r")) == NULL) | 295 | if ((tty=fopen("con","r")) == NULL) |
276 | tty=stdin; | 296 | tty=stdin; |
277 | #elif defined(MAC_OS_pre_X) || defined(OPENSSL_SYS_VSWORKS) | 297 | #elif defined(MAC_OS_pre_X) || defined(OPENSSL_SYS_VXWORKS) |
278 | tty=stdin; | 298 | tty=stdin; |
279 | #else | 299 | #else |
280 | #ifndef OPENSSL_SYS_MPE | 300 | #ifndef OPENSSL_SYS_MPE |
@@ -393,17 +413,6 @@ error: | |||
393 | return(!ok); | 413 | return(!ok); |
394 | } | 414 | } |
395 | 415 | ||
396 | #else /* OPENSSL_SYS_WIN16 */ | ||
397 | |||
398 | int des_read_pw(char *buf, char *buff, int size, char *prompt, int verify) | ||
399 | { | ||
400 | memset(buf,0,size); | ||
401 | memset(buff,0,size); | ||
402 | return(0); | ||
403 | } | ||
404 | |||
405 | #endif | ||
406 | |||
407 | static void pushsig(void) | 416 | static void pushsig(void) |
408 | { | 417 | { |
409 | int i; | 418 | int i; |
@@ -466,7 +475,7 @@ static void recsig(int i) | |||
466 | #endif | 475 | #endif |
467 | } | 476 | } |
468 | 477 | ||
469 | #if defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_WIN16) | 478 | #ifdef OPENSSL_SYS_MSDOS |
470 | static int noecho_fgets(char *buf, int size, FILE *tty) | 479 | static int noecho_fgets(char *buf, int size, FILE *tty) |
471 | { | 480 | { |
472 | int i; | 481 | int i; |
@@ -509,3 +518,4 @@ static int noecho_fgets(char *buf, int size, FILE *tty) | |||
509 | return(strlen(buf)); | 518 | return(strlen(buf)); |
510 | } | 519 | } |
511 | #endif | 520 | #endif |
521 | #endif /* !OPENSSL_SYS_WINCE && !WIN16 */ | ||
diff --git a/src/lib/libcrypto/dh/dhtest.c b/src/lib/libcrypto/dh/dhtest.c index 34894ced73..d75077f9fa 100644 --- a/src/lib/libcrypto/dh/dhtest.c +++ b/src/lib/libcrypto/dh/dhtest.c | |||
@@ -59,9 +59,9 @@ | |||
59 | #include <stdio.h> | 59 | #include <stdio.h> |
60 | #include <stdlib.h> | 60 | #include <stdlib.h> |
61 | #include <string.h> | 61 | #include <string.h> |
62 | #ifdef OPENSSL_SYS_WINDOWS | 62 | |
63 | #include "../bio/bss_file.c" | 63 | #include "../e_os.h" |
64 | #endif | 64 | |
65 | #include <openssl/crypto.h> | 65 | #include <openssl/crypto.h> |
66 | #include <openssl/bio.h> | 66 | #include <openssl/bio.h> |
67 | #include <openssl/bn.h> | 67 | #include <openssl/bn.h> |
@@ -84,10 +84,6 @@ int main(int argc, char *argv[]) | |||
84 | #endif | 84 | #endif |
85 | 85 | ||
86 | static void MS_CALLBACK cb(int p, int n, void *arg); | 86 | static void MS_CALLBACK cb(int p, int n, void *arg); |
87 | #ifdef OPENSSL_NO_STDIO | ||
88 | #define APPS_WIN16 | ||
89 | #include "bss_file.c" | ||
90 | #endif | ||
91 | 87 | ||
92 | static const char rnd_seed[] = "string to make the random number generator think it has entropy"; | 88 | static const char rnd_seed[] = "string to make the random number generator think it has entropy"; |
93 | 89 | ||
@@ -111,7 +107,7 @@ int main(int argc, char *argv[]) | |||
111 | RAND_seed(rnd_seed, sizeof rnd_seed); | 107 | RAND_seed(rnd_seed, sizeof rnd_seed); |
112 | 108 | ||
113 | out=BIO_new(BIO_s_file()); | 109 | out=BIO_new(BIO_s_file()); |
114 | if (out == NULL) exit(1); | 110 | if (out == NULL) EXIT(1); |
115 | BIO_set_fp(out,stdout,BIO_NOCLOSE); | 111 | BIO_set_fp(out,stdout,BIO_NOCLOSE); |
116 | 112 | ||
117 | a=DH_generate_parameters(64,DH_GENERATOR_5,cb,out); | 113 | a=DH_generate_parameters(64,DH_GENERATOR_5,cb,out); |
@@ -195,7 +191,7 @@ err: | |||
195 | CRYPTO_cleanup_all_ex_data(); | 191 | CRYPTO_cleanup_all_ex_data(); |
196 | ERR_remove_state(0); | 192 | ERR_remove_state(0); |
197 | CRYPTO_mem_leaks_fp(stderr); | 193 | CRYPTO_mem_leaks_fp(stderr); |
198 | exit(ret); | 194 | EXIT(ret); |
199 | return(ret); | 195 | return(ret); |
200 | } | 196 | } |
201 | 197 | ||
diff --git a/src/lib/libcrypto/dsa/dsagen.c b/src/lib/libcrypto/dsa/dsagen.c index a0b0976640..1b6a1cca0f 100644 --- a/src/lib/libcrypto/dsa/dsagen.c +++ b/src/lib/libcrypto/dsa/dsagen.c | |||
@@ -103,7 +103,7 @@ main() | |||
103 | bio_err=BIO_new_fp(stderr,BIO_NOCLOSE); | 103 | bio_err=BIO_new_fp(stderr,BIO_NOCLOSE); |
104 | 104 | ||
105 | memcpy(seed_buf,seed,20); | 105 | memcpy(seed_buf,seed,20); |
106 | dsa=DSA_generate_parameters(1024,seed,20,&counter,&h,cb); | 106 | dsa=DSA_generate_parameters(1024,seed,20,&counter,&h,cb,bio_err); |
107 | 107 | ||
108 | if (dsa == NULL) | 108 | if (dsa == NULL) |
109 | DSA_print(bio_err,dsa,0); | 109 | DSA_print(bio_err,dsa,0); |
diff --git a/src/lib/libcrypto/dsa/dsatest.c b/src/lib/libcrypto/dsa/dsatest.c index 12da64f9f4..4734ce4af8 100644 --- a/src/lib/libcrypto/dsa/dsatest.c +++ b/src/lib/libcrypto/dsa/dsatest.c | |||
@@ -61,14 +61,13 @@ | |||
61 | #include <string.h> | 61 | #include <string.h> |
62 | #include <sys/types.h> | 62 | #include <sys/types.h> |
63 | #include <sys/stat.h> | 63 | #include <sys/stat.h> |
64 | |||
65 | #include "../e_os.h" | ||
66 | |||
64 | #include <openssl/crypto.h> | 67 | #include <openssl/crypto.h> |
65 | #include <openssl/rand.h> | 68 | #include <openssl/rand.h> |
66 | #include <openssl/bio.h> | 69 | #include <openssl/bio.h> |
67 | #include <openssl/err.h> | 70 | #include <openssl/err.h> |
68 | #include <openssl/engine.h> | ||
69 | #ifdef OPENSSL_SYS_WINDOWS | ||
70 | #include "../bio/bss_file.c" | ||
71 | #endif | ||
72 | 71 | ||
73 | #ifdef OPENSSL_NO_DSA | 72 | #ifdef OPENSSL_NO_DSA |
74 | int main(int argc, char *argv[]) | 73 | int main(int argc, char *argv[]) |
@@ -212,10 +211,16 @@ end: | |||
212 | BIO_free(bio_err); | 211 | BIO_free(bio_err); |
213 | bio_err = NULL; | 212 | bio_err = NULL; |
214 | } | 213 | } |
215 | exit(!ret); | 214 | EXIT(!ret); |
216 | return(0); | 215 | return(0); |
217 | } | 216 | } |
218 | 217 | ||
218 | static int cb_exit(int ec) | ||
219 | { | ||
220 | EXIT(ec); | ||
221 | return(0); /* To keep some compilers quiet */ | ||
222 | } | ||
223 | |||
219 | static void MS_CALLBACK dsa_cb(int p, int n, void *arg) | 224 | static void MS_CALLBACK dsa_cb(int p, int n, void *arg) |
220 | { | 225 | { |
221 | char c='*'; | 226 | char c='*'; |
@@ -231,7 +236,7 @@ static void MS_CALLBACK dsa_cb(int p, int n, void *arg) | |||
231 | if (!ok && (p == 0) && (num > 1)) | 236 | if (!ok && (p == 0) && (num > 1)) |
232 | { | 237 | { |
233 | BIO_printf((BIO *)arg,"error in dsatest\n"); | 238 | BIO_printf((BIO *)arg,"error in dsatest\n"); |
234 | exit(1); | 239 | cb_exit(1); |
235 | } | 240 | } |
236 | } | 241 | } |
237 | #endif | 242 | #endif |
diff --git a/src/lib/libcrypto/dso/dso_dl.c b/src/lib/libcrypto/dso/dso_dl.c index 195717e993..79d2cb4d8c 100644 --- a/src/lib/libcrypto/dso/dso_dl.c +++ b/src/lib/libcrypto/dso/dso_dl.c | |||
@@ -126,7 +126,7 @@ static int dl_load(DSO *dso) | |||
126 | DSOerr(DSO_F_DL_LOAD,DSO_R_NO_FILENAME); | 126 | DSOerr(DSO_F_DL_LOAD,DSO_R_NO_FILENAME); |
127 | goto err; | 127 | goto err; |
128 | } | 128 | } |
129 | ptr = shl_load(filename, BIND_IMMEDIATE|DYNAMIC_PATH, NULL); | 129 | ptr = shl_load(filename, BIND_IMMEDIATE|DYNAMIC_PATH, 0L); |
130 | if(ptr == NULL) | 130 | if(ptr == NULL) |
131 | { | 131 | { |
132 | DSOerr(DSO_F_DL_LOAD,DSO_R_LOAD_FAILED); | 132 | DSOerr(DSO_F_DL_LOAD,DSO_R_LOAD_FAILED); |
diff --git a/src/lib/libcrypto/dso/dso_win32.c b/src/lib/libcrypto/dso/dso_win32.c index af8586d754..6c30deb250 100644 --- a/src/lib/libcrypto/dso/dso_win32.c +++ b/src/lib/libcrypto/dso/dso_win32.c | |||
@@ -61,7 +61,7 @@ | |||
61 | #include "cryptlib.h" | 61 | #include "cryptlib.h" |
62 | #include <openssl/dso.h> | 62 | #include <openssl/dso.h> |
63 | 63 | ||
64 | #ifndef OPENSSL_SYS_WIN32 | 64 | #if !defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_WINCE) |
65 | DSO_METHOD *DSO_METHOD_win32(void) | 65 | DSO_METHOD *DSO_METHOD_win32(void) |
66 | { | 66 | { |
67 | return NULL; | 67 | return NULL; |
diff --git a/src/lib/libcrypto/ec/ectest.c b/src/lib/libcrypto/ec/ectest.c index eab46cc080..345d3e4289 100644 --- a/src/lib/libcrypto/ec/ectest.c +++ b/src/lib/libcrypto/ec/ectest.c | |||
@@ -55,6 +55,11 @@ | |||
55 | 55 | ||
56 | #include <stdio.h> | 56 | #include <stdio.h> |
57 | #include <stdlib.h> | 57 | #include <stdlib.h> |
58 | #ifdef FLAT_INC | ||
59 | #include "e_os.h" | ||
60 | #else | ||
61 | #include "../e_os.h" | ||
62 | #endif | ||
58 | #include <string.h> | 63 | #include <string.h> |
59 | #include <time.h> | 64 | #include <time.h> |
60 | 65 | ||
@@ -65,14 +70,16 @@ int main(int argc, char * argv[]) { puts("Elliptic curves are disabled."); retur | |||
65 | 70 | ||
66 | 71 | ||
67 | #include <openssl/ec.h> | 72 | #include <openssl/ec.h> |
73 | #ifndef OPENSSL_NO_ENGINE | ||
68 | #include <openssl/engine.h> | 74 | #include <openssl/engine.h> |
75 | #endif | ||
69 | #include <openssl/err.h> | 76 | #include <openssl/err.h> |
70 | 77 | ||
71 | #define ABORT do { \ | 78 | #define ABORT do { \ |
72 | fflush(stdout); \ | 79 | fflush(stdout); \ |
73 | fprintf(stderr, "%s:%d: ABORT\n", __FILE__, __LINE__); \ | 80 | fprintf(stderr, "%s:%d: ABORT\n", __FILE__, __LINE__); \ |
74 | ERR_print_errors_fp(stderr); \ | 81 | ERR_print_errors_fp(stderr); \ |
75 | exit(1); \ | 82 | EXIT(1); \ |
76 | } while (0) | 83 | } while (0) |
77 | 84 | ||
78 | #if 0 | 85 | #if 0 |
@@ -623,7 +630,9 @@ int main(int argc, char *argv[]) | |||
623 | if (P_384) EC_GROUP_free(P_384); | 630 | if (P_384) EC_GROUP_free(P_384); |
624 | if (P_521) EC_GROUP_free(P_521); | 631 | if (P_521) EC_GROUP_free(P_521); |
625 | 632 | ||
633 | #ifndef OPENSSL_NO_ENGINE | ||
626 | ENGINE_cleanup(); | 634 | ENGINE_cleanup(); |
635 | #endif | ||
627 | CRYPTO_cleanup_all_ex_data(); | 636 | CRYPTO_cleanup_all_ex_data(); |
628 | ERR_free_strings(); | 637 | ERR_free_strings(); |
629 | ERR_remove_state(0); | 638 | ERR_remove_state(0); |
diff --git a/src/lib/libcrypto/engine/enginetest.c b/src/lib/libcrypto/engine/enginetest.c index 87fa8c57b7..c2d0297392 100644 --- a/src/lib/libcrypto/engine/enginetest.c +++ b/src/lib/libcrypto/engine/enginetest.c | |||
@@ -56,9 +56,17 @@ | |||
56 | * | 56 | * |
57 | */ | 57 | */ |
58 | 58 | ||
59 | #include <openssl/e_os2.h> | ||
60 | #include <stdio.h> | 59 | #include <stdio.h> |
61 | #include <string.h> | 60 | #include <string.h> |
61 | |||
62 | #ifdef OPENSSL_NO_ENGINE | ||
63 | int main(int argc, char *argv[]) | ||
64 | { | ||
65 | printf("No ENGINE support\n"); | ||
66 | return(0); | ||
67 | } | ||
68 | #else | ||
69 | #include <openssl/e_os2.h> | ||
62 | #include <openssl/buffer.h> | 70 | #include <openssl/buffer.h> |
63 | #include <openssl/crypto.h> | 71 | #include <openssl/crypto.h> |
64 | #include <openssl/engine.h> | 72 | #include <openssl/engine.h> |
@@ -272,3 +280,4 @@ end: | |||
272 | CRYPTO_mem_leaks_fp(stderr); | 280 | CRYPTO_mem_leaks_fp(stderr); |
273 | return to_return; | 281 | return to_return; |
274 | } | 282 | } |
283 | #endif | ||
diff --git a/src/lib/libcrypto/engine/hw_4758_cca.c b/src/lib/libcrypto/engine/hw_4758_cca.c index bfb80968e2..4f5ae8a46d 100644 --- a/src/lib/libcrypto/engine/hw_4758_cca.c +++ b/src/lib/libcrypto/engine/hw_4758_cca.c | |||
@@ -223,6 +223,7 @@ static int bind_helper(ENGINE *e) | |||
223 | return 1; | 223 | return 1; |
224 | } | 224 | } |
225 | 225 | ||
226 | #ifndef ENGINE_DYNAMIC_SUPPORT | ||
226 | static ENGINE *engine_4758_cca(void) | 227 | static ENGINE *engine_4758_cca(void) |
227 | { | 228 | { |
228 | ENGINE *ret = ENGINE_new(); | 229 | ENGINE *ret = ENGINE_new(); |
@@ -244,6 +245,7 @@ void ENGINE_load_4758cca(void) | |||
244 | ENGINE_free(e_4758); | 245 | ENGINE_free(e_4758); |
245 | ERR_clear_error(); | 246 | ERR_clear_error(); |
246 | } | 247 | } |
248 | #endif | ||
247 | 249 | ||
248 | static int ibm_4758_cca_destroy(ENGINE *e) | 250 | static int ibm_4758_cca_destroy(ENGINE *e) |
249 | { | 251 | { |
@@ -715,7 +717,7 @@ static int cca_rsa_verify(int type, const unsigned char *m, unsigned int m_len, | |||
715 | 717 | ||
716 | if (type == NID_sha1 || type == NID_md5) | 718 | if (type == NID_sha1 || type == NID_md5) |
717 | { | 719 | { |
718 | memset(hashBuffer, keyLength+1, 0); | 720 | OPENSSL_cleanse(hashBuffer, keyLength+1); |
719 | OPENSSL_free(hashBuffer); | 721 | OPENSSL_free(hashBuffer); |
720 | } | 722 | } |
721 | 723 | ||
@@ -838,7 +840,7 @@ static int cca_rsa_sign(int type, const unsigned char *m, unsigned int m_len, | |||
838 | 840 | ||
839 | if (type == NID_sha1 || type == NID_md5) | 841 | if (type == NID_sha1 || type == NID_md5) |
840 | { | 842 | { |
841 | memset(hashBuffer, keyLength+1, 0); | 843 | OPENSSL_cleanse(hashBuffer, keyLength+1); |
842 | OPENSSL_free(hashBuffer); | 844 | OPENSSL_free(hashBuffer); |
843 | } | 845 | } |
844 | 846 | ||
diff --git a/src/lib/libcrypto/engine/hw_atalla.c b/src/lib/libcrypto/engine/hw_atalla.c index 6151c46902..e9eff9fad1 100644 --- a/src/lib/libcrypto/engine/hw_atalla.c +++ b/src/lib/libcrypto/engine/hw_atalla.c | |||
@@ -242,6 +242,7 @@ static int bind_helper(ENGINE *e) | |||
242 | return 1; | 242 | return 1; |
243 | } | 243 | } |
244 | 244 | ||
245 | #ifndef ENGINE_DYNAMIC_SUPPORT | ||
245 | static ENGINE *engine_atalla(void) | 246 | static ENGINE *engine_atalla(void) |
246 | { | 247 | { |
247 | ENGINE *ret = ENGINE_new(); | 248 | ENGINE *ret = ENGINE_new(); |
@@ -264,6 +265,7 @@ void ENGINE_load_atalla(void) | |||
264 | ENGINE_free(toadd); | 265 | ENGINE_free(toadd); |
265 | ERR_clear_error(); | 266 | ERR_clear_error(); |
266 | } | 267 | } |
268 | #endif | ||
267 | 269 | ||
268 | /* This is a process-global DSO handle used for loading and unloading | 270 | /* This is a process-global DSO handle used for loading and unloading |
269 | * the Atalla library. NB: This is only set (or unset) during an | 271 | * the Atalla library. NB: This is only set (or unset) during an |
diff --git a/src/lib/libcrypto/engine/hw_cryptodev.c b/src/lib/libcrypto/engine/hw_cryptodev.c index 7c3728f395..40af97ac24 100644 --- a/src/lib/libcrypto/engine/hw_cryptodev.c +++ b/src/lib/libcrypto/engine/hw_cryptodev.c | |||
@@ -1,6 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2002 Bob Beck <beck@openbsd.org> | 2 | * Copyright (c) 2002 Bob Beck <beck@openbsd.org> |
3 | * Copyright (c) 2002 Theo de Raadt | 3 | * Copyright (c) 2002 Theo de Raadt |
4 | * Copyright (c) 2002 Markus Friedl | ||
4 | * All rights reserved. | 5 | * All rights reserved. |
5 | * | 6 | * |
6 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without |
@@ -28,33 +29,85 @@ | |||
28 | * | 29 | * |
29 | */ | 30 | */ |
30 | 31 | ||
31 | #include <sys/types.h> | 32 | #include <openssl/objects.h> |
33 | #include <openssl/engine.h> | ||
34 | #include <openssl/evp.h> | ||
35 | |||
36 | #if (defined(__unix__) || defined(unix)) && !defined(USG) | ||
32 | #include <sys/param.h> | 37 | #include <sys/param.h> |
38 | # if (OpenBSD >= 200112) || ((__FreeBSD_version >= 470101 && __FreeBSD_version < 500000) || __FreeBSD_version >= 500041) | ||
39 | # define HAVE_CRYPTODEV | ||
40 | # endif | ||
41 | # if (OpenBSD >= 200110) | ||
42 | # define HAVE_SYSLOG_R | ||
43 | # endif | ||
44 | #endif | ||
45 | |||
46 | #ifndef HAVE_CRYPTODEV | ||
47 | |||
48 | void | ||
49 | ENGINE_load_cryptodev(void) | ||
50 | { | ||
51 | /* This is a NOP on platforms without /dev/crypto */ | ||
52 | return; | ||
53 | } | ||
54 | |||
55 | #else | ||
56 | |||
57 | #include <sys/types.h> | ||
33 | #include <crypto/cryptodev.h> | 58 | #include <crypto/cryptodev.h> |
34 | #include <sys/ioctl.h> | 59 | #include <sys/ioctl.h> |
35 | #include <errno.h> | 60 | #include <errno.h> |
36 | #include <stdio.h> | 61 | #include <stdio.h> |
37 | #include <unistd.h> | 62 | #include <unistd.h> |
38 | #include <fcntl.h> | 63 | #include <fcntl.h> |
39 | #include <syslog.h> | ||
40 | #include <stdarg.h> | 64 | #include <stdarg.h> |
41 | #include <ssl/objects.h> | 65 | #include <syslog.h> |
42 | #include <ssl/engine.h> | 66 | #include <errno.h> |
43 | #include <ssl/evp.h> | 67 | #include <string.h> |
44 | 68 | ||
45 | static int cryptodev_fd = -1; | 69 | struct dev_crypto_state { |
46 | static int cryptodev_sessions = 0; | 70 | struct session_op d_sess; |
47 | static u_int32_t cryptodev_symfeat = 0; | 71 | int d_fd; |
72 | }; | ||
48 | 73 | ||
74 | static u_int32_t cryptodev_asymfeat = 0; | ||
75 | |||
76 | static int get_asym_dev_crypto(void); | ||
77 | static int open_dev_crypto(void); | ||
78 | static int get_dev_crypto(void); | ||
79 | static int cryptodev_max_iv(int cipher); | ||
80 | static int cryptodev_key_length_valid(int cipher, int len); | ||
81 | static int cipher_nid_to_cryptodev(int nid); | ||
82 | static int get_cryptodev_ciphers(const int **cnids); | ||
83 | static int get_cryptodev_digests(const int **cnids); | ||
84 | static int cryptodev_usable_ciphers(const int **nids); | ||
85 | static int cryptodev_usable_digests(const int **nids); | ||
86 | static int cryptodev_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
87 | const unsigned char *in, unsigned int inl); | ||
88 | static int cryptodev_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | ||
89 | const unsigned char *iv, int enc); | ||
90 | static int cryptodev_cleanup(EVP_CIPHER_CTX *ctx); | ||
91 | static int cryptodev_engine_ciphers(ENGINE *e, const EVP_CIPHER **cipher, | ||
92 | const int **nids, int nid); | ||
93 | static int cryptodev_engine_digests(ENGINE *e, const EVP_MD **digest, | ||
94 | const int **nids, int nid); | ||
49 | static int bn2crparam(const BIGNUM *a, struct crparam *crp); | 95 | static int bn2crparam(const BIGNUM *a, struct crparam *crp); |
50 | static int crparam2bn(struct crparam *crp, BIGNUM *a); | 96 | static int crparam2bn(struct crparam *crp, BIGNUM *a); |
51 | static void zapparams(struct crypt_kop *kop); | 97 | static void zapparams(struct crypt_kop *kop); |
98 | static int cryptodev_asym(struct crypt_kop *kop, int rlen, BIGNUM *r, | ||
99 | int slen, BIGNUM *s); | ||
52 | 100 | ||
53 | static int cryptodev_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa); | ||
54 | static int cryptodev_bn_mod_exp(BIGNUM *r, const BIGNUM *a, | 101 | static int cryptodev_bn_mod_exp(BIGNUM *r, const BIGNUM *a, |
55 | const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); | 102 | const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); |
103 | static int cryptodev_rsa_nocrt_mod_exp(BIGNUM *r0, const BIGNUM *I, | ||
104 | RSA *rsa); | ||
105 | static int cryptodev_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa); | ||
56 | static int cryptodev_dsa_bn_mod_exp(DSA *dsa, BIGNUM *r, BIGNUM *a, | 106 | static int cryptodev_dsa_bn_mod_exp(DSA *dsa, BIGNUM *r, BIGNUM *a, |
57 | const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); | 107 | const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); |
108 | static int cryptodev_dsa_dsa_mod_exp(DSA *dsa, BIGNUM *t1, BIGNUM *g, | ||
109 | BIGNUM *u1, BIGNUM *pub_key, BIGNUM *u2, BIGNUM *p, | ||
110 | BN_CTX *ctx, BN_MONT_CTX *mont); | ||
58 | static DSA_SIG *cryptodev_dsa_do_sign(const unsigned char *dgst, | 111 | static DSA_SIG *cryptodev_dsa_do_sign(const unsigned char *dgst, |
59 | int dlen, DSA *dsa); | 112 | int dlen, DSA *dsa); |
60 | static int cryptodev_dsa_verify(const unsigned char *dgst, int dgst_len, | 113 | static int cryptodev_dsa_verify(const unsigned char *dgst, int dgst_len, |
@@ -64,6 +117,9 @@ static int cryptodev_mod_exp_dh(const DH *dh, BIGNUM *r, const BIGNUM *a, | |||
64 | BN_MONT_CTX *m_ctx); | 117 | BN_MONT_CTX *m_ctx); |
65 | static int cryptodev_dh_compute_key(unsigned char *key, | 118 | static int cryptodev_dh_compute_key(unsigned char *key, |
66 | const BIGNUM *pub_key, DH *dh); | 119 | const BIGNUM *pub_key, DH *dh); |
120 | static int cryptodev_ctrl(ENGINE *e, int cmd, long i, void *p, | ||
121 | void (*f)()); | ||
122 | void ENGINE_load_cryptodev(void); | ||
67 | 123 | ||
68 | static const ENGINE_CMD_DEFN cryptodev_defns[] = { | 124 | static const ENGINE_CMD_DEFN cryptodev_defns[] = { |
69 | { 0, NULL, NULL, 0 } | 125 | { 0, NULL, NULL, 0 } |
@@ -77,11 +133,10 @@ static struct { | |||
77 | } ciphers[] = { | 133 | } ciphers[] = { |
78 | { CRYPTO_DES_CBC, NID_des_cbc, 8, 8, }, | 134 | { CRYPTO_DES_CBC, NID_des_cbc, 8, 8, }, |
79 | { CRYPTO_3DES_CBC, NID_des_ede3_cbc, 8, 24, }, | 135 | { CRYPTO_3DES_CBC, NID_des_ede3_cbc, 8, 24, }, |
80 | { CRYPTO_AES_CBC, NID_undef, 8, 24, }, | 136 | { CRYPTO_AES_CBC, NID_aes_128_cbc, 16, 16, }, |
81 | { CRYPTO_BLF_CBC, NID_bf_cbc, 8, 16, }, | 137 | { CRYPTO_BLF_CBC, NID_bf_cbc, 8, 16, }, |
82 | { CRYPTO_CAST_CBC, NID_cast5_cbc, 8, 8, }, | 138 | { CRYPTO_CAST_CBC, NID_cast5_cbc, 8, 16, }, |
83 | { CRYPTO_SKIPJACK_CBC, NID_undef, 0, 0, }, | 139 | { CRYPTO_SKIPJACK_CBC, NID_undef, 0, 0, }, |
84 | { CRYPTO_ARC4, NID_rc4, 8, 16, }, | ||
85 | { 0, NID_undef, 0, 0, }, | 140 | { 0, NID_undef, 0, 0, }, |
86 | }; | 141 | }; |
87 | 142 | ||
@@ -99,33 +154,53 @@ static struct { | |||
99 | }; | 154 | }; |
100 | 155 | ||
101 | /* | 156 | /* |
102 | * Return 1 if /dev/crypto seems usable, 0 otherwise , also | 157 | * Return a fd if /dev/crypto seems usable, 0 otherwise. |
103 | * does most of the work of initting the device, if not already | ||
104 | * done.. This should leave is with global fd initialized with CRIOGET. | ||
105 | */ | 158 | */ |
106 | static int | 159 | static int |
107 | check_dev_crypto() | 160 | open_dev_crypto(void) |
108 | { | 161 | { |
109 | int fd; | 162 | static int fd = -1; |
110 | 163 | ||
111 | if (cryptodev_fd == -1) { | 164 | if (fd == -1) { |
112 | if ((fd = open("/dev/crypto", O_RDWR, 0)) == -1) | 165 | if ((fd = open("/dev/crypto", O_RDWR, 0)) == -1) |
113 | return (0); | 166 | return (-1); |
114 | if (ioctl(fd, CRIOGET, &cryptodev_fd) == -1) { | ||
115 | close(fd); | ||
116 | return (0); | ||
117 | } | ||
118 | close(fd); | ||
119 | /* close on exec */ | 167 | /* close on exec */ |
120 | if (fcntl(cryptodev_fd, F_SETFD, 1) == -1) { | 168 | if (fcntl(fd, F_SETFD, 1) == -1) { |
121 | close(cryptodev_fd); | 169 | close(fd); |
122 | cryptodev_fd = -1; | 170 | fd = -1; |
123 | return (0); | 171 | return (-1); |
124 | } | 172 | } |
125 | } | 173 | } |
126 | ioctl(cryptodev_fd, CIOCSYMFEAT, &cryptodev_symfeat); | 174 | return (fd); |
175 | } | ||
127 | 176 | ||
128 | return (1); | 177 | static int |
178 | get_dev_crypto(void) | ||
179 | { | ||
180 | int fd, retfd; | ||
181 | |||
182 | if ((fd = open_dev_crypto()) == -1) | ||
183 | return (-1); | ||
184 | if (ioctl(fd, CRIOGET, &retfd) == -1) | ||
185 | return (-1); | ||
186 | |||
187 | /* close on exec */ | ||
188 | if (fcntl(retfd, F_SETFD, 1) == -1) { | ||
189 | close(retfd); | ||
190 | return (-1); | ||
191 | } | ||
192 | return (retfd); | ||
193 | } | ||
194 | |||
195 | /* Caching version for asym operations */ | ||
196 | static int | ||
197 | get_asym_dev_crypto(void) | ||
198 | { | ||
199 | static int fd = -1; | ||
200 | |||
201 | if (fd == -1) | ||
202 | fd = get_dev_crypto(); | ||
203 | return fd; | ||
129 | } | 204 | } |
130 | 205 | ||
131 | /* | 206 | /* |
@@ -183,8 +258,12 @@ get_cryptodev_ciphers(const int **cnids) | |||
183 | { | 258 | { |
184 | static int nids[CRYPTO_ALGORITHM_MAX]; | 259 | static int nids[CRYPTO_ALGORITHM_MAX]; |
185 | struct session_op sess; | 260 | struct session_op sess; |
186 | int i, count = 0; | 261 | int fd, i, count = 0; |
187 | 262 | ||
263 | if ((fd = get_dev_crypto()) < 0) { | ||
264 | *nids = NULL; | ||
265 | return (0); | ||
266 | } | ||
188 | memset(&sess, 0, sizeof(sess)); | 267 | memset(&sess, 0, sizeof(sess)); |
189 | sess.key = (caddr_t)"123456781234567812345678"; | 268 | sess.key = (caddr_t)"123456781234567812345678"; |
190 | 269 | ||
@@ -194,10 +273,12 @@ get_cryptodev_ciphers(const int **cnids) | |||
194 | sess.cipher = ciphers[i].id; | 273 | sess.cipher = ciphers[i].id; |
195 | sess.keylen = ciphers[i].keylen; | 274 | sess.keylen = ciphers[i].keylen; |
196 | sess.mac = 0; | 275 | sess.mac = 0; |
197 | if (ioctl(cryptodev_fd, CIOCGSESSION, &sess) != -1 && | 276 | if (ioctl(fd, CIOCGSESSION, &sess) != -1 && |
198 | ioctl(cryptodev_fd, CIOCFSESSION, &sess.ses) != -1) | 277 | ioctl(fd, CIOCFSESSION, &sess.ses) != -1) |
199 | nids[count++] = ciphers[i].nid; | 278 | nids[count++] = ciphers[i].nid; |
200 | } | 279 | } |
280 | close(fd); | ||
281 | |||
201 | if (count > 0) | 282 | if (count > 0) |
202 | *cnids = nids; | 283 | *cnids = nids; |
203 | else | 284 | else |
@@ -216,18 +297,24 @@ get_cryptodev_digests(const int **cnids) | |||
216 | { | 297 | { |
217 | static int nids[CRYPTO_ALGORITHM_MAX]; | 298 | static int nids[CRYPTO_ALGORITHM_MAX]; |
218 | struct session_op sess; | 299 | struct session_op sess; |
219 | int i, count = 0; | 300 | int fd, i, count = 0; |
220 | 301 | ||
302 | if ((fd = get_dev_crypto()) < 0) { | ||
303 | *nids = NULL; | ||
304 | return (0); | ||
305 | } | ||
221 | memset(&sess, 0, sizeof(sess)); | 306 | memset(&sess, 0, sizeof(sess)); |
222 | for (i = 0; digests[i].id && count < CRYPTO_ALGORITHM_MAX; i++) { | 307 | for (i = 0; digests[i].id && count < CRYPTO_ALGORITHM_MAX; i++) { |
223 | if (digests[i].nid == NID_undef) | 308 | if (digests[i].nid == NID_undef) |
224 | continue; | 309 | continue; |
225 | sess.mac = digests[i].id; | 310 | sess.mac = digests[i].id; |
226 | sess.cipher = 0; | 311 | sess.cipher = 0; |
227 | if (ioctl(cryptodev_fd, CIOCGSESSION, &sess) != -1 && | 312 | if (ioctl(fd, CIOCGSESSION, &sess) != -1 && |
228 | ioctl(cryptodev_fd, CIOCFSESSION, &sess.ses) != -1) | 313 | ioctl(fd, CIOCFSESSION, &sess.ses) != -1) |
229 | nids[count++] = digests[i].nid; | 314 | nids[count++] = digests[i].nid; |
230 | } | 315 | } |
316 | close(fd); | ||
317 | |||
231 | if (count > 0) | 318 | if (count > 0) |
232 | *cnids = nids; | 319 | *cnids = nids; |
233 | else | 320 | else |
@@ -256,25 +343,15 @@ get_cryptodev_digests(const int **cnids) | |||
256 | * want most of the decisions made about what we actually want | 343 | * want most of the decisions made about what we actually want |
257 | * to use from /dev/crypto. | 344 | * to use from /dev/crypto. |
258 | */ | 345 | */ |
259 | int | 346 | static int |
260 | cryptodev_usable_ciphers(const int **nids) | 347 | cryptodev_usable_ciphers(const int **nids) |
261 | { | 348 | { |
262 | if (!check_dev_crypto()) { | ||
263 | *nids = NULL; | ||
264 | return (0); | ||
265 | } | ||
266 | |||
267 | /* find what the device can do. Unfortunately, we don't | ||
268 | * necessarily want all of these yet, because we aren't | ||
269 | * yet set up to do them | ||
270 | */ | ||
271 | return (get_cryptodev_ciphers(nids)); | 349 | return (get_cryptodev_ciphers(nids)); |
272 | } | 350 | } |
273 | 351 | ||
274 | int | 352 | static int |
275 | cryptodev_usable_digests(const int **nids) | 353 | cryptodev_usable_digests(const int **nids) |
276 | { | 354 | { |
277 | #if 1 | ||
278 | /* | 355 | /* |
279 | * XXXX just disable all digests for now, because it sucks. | 356 | * XXXX just disable all digests for now, because it sucks. |
280 | * we need a better way to decide this - i.e. I may not | 357 | * we need a better way to decide this - i.e. I may not |
@@ -289,29 +366,19 @@ cryptodev_usable_digests(const int **nids) | |||
289 | */ | 366 | */ |
290 | *nids = NULL; | 367 | *nids = NULL; |
291 | return (0); | 368 | return (0); |
292 | #endif | ||
293 | |||
294 | if (!check_dev_crypto()) { | ||
295 | *nids = NULL; | ||
296 | return (0); | ||
297 | } | ||
298 | return (get_cryptodev_digests(nids)); | ||
299 | } | 369 | } |
300 | 370 | ||
301 | 371 | static int | |
302 | int | ||
303 | cryptodev_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | 372 | cryptodev_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, |
304 | const unsigned char *in, unsigned int inl) | 373 | const unsigned char *in, unsigned int inl) |
305 | { | 374 | { |
306 | struct crypt_op cryp; | 375 | struct crypt_op cryp; |
307 | struct session_op *sess = ctx->cipher_data; | 376 | struct dev_crypto_state *state = ctx->cipher_data; |
377 | struct session_op *sess = &state->d_sess; | ||
308 | void *iiv; | 378 | void *iiv; |
309 | unsigned char save_iv[EVP_MAX_IV_LENGTH]; | 379 | unsigned char save_iv[EVP_MAX_IV_LENGTH]; |
310 | struct syslog_data sd = SYSLOG_DATA_INIT; | ||
311 | 380 | ||
312 | if (cryptodev_fd == -1) | 381 | if (state->d_fd < 0) |
313 | return (0); | ||
314 | if (sess == NULL) | ||
315 | return (0); | 382 | return (0); |
316 | if (!inl) | 383 | if (!inl) |
317 | return (1); | 384 | return (1); |
@@ -338,11 +405,10 @@ cryptodev_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | |||
338 | } else | 405 | } else |
339 | cryp.iv = NULL; | 406 | cryp.iv = NULL; |
340 | 407 | ||
341 | if (ioctl(cryptodev_fd, CIOCCRYPT, &cryp) == -1) { | 408 | if (ioctl(state->d_fd, CIOCCRYPT, &cryp) == -1) { |
342 | /* XXX need better errror handling | 409 | /* XXX need better errror handling |
343 | * this can fail for a number of different reasons. | 410 | * this can fail for a number of different reasons. |
344 | */ | 411 | */ |
345 | syslog_r(LOG_ERR, &sd, "CIOCCRYPT failed (%m)"); | ||
346 | return (0); | 412 | return (0); |
347 | } | 413 | } |
348 | 414 | ||
@@ -356,20 +422,17 @@ cryptodev_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | |||
356 | return (1); | 422 | return (1); |
357 | } | 423 | } |
358 | 424 | ||
359 | int | 425 | static int |
360 | cryptodev_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | 426 | cryptodev_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, |
361 | const unsigned char *iv, int enc) | 427 | const unsigned char *iv, int enc) |
362 | { | 428 | { |
363 | struct session_op *sess = ctx->cipher_data; | 429 | struct dev_crypto_state *state = ctx->cipher_data; |
364 | struct syslog_data sd = SYSLOG_DATA_INIT; | 430 | struct session_op *sess = &state->d_sess; |
365 | int cipher; | 431 | int cipher; |
366 | 432 | ||
367 | if ((cipher = cipher_nid_to_cryptodev(ctx->cipher->nid)) == NID_undef) | 433 | if ((cipher = cipher_nid_to_cryptodev(ctx->cipher->nid)) == NID_undef) |
368 | return (0); | 434 | return (0); |
369 | 435 | ||
370 | if (!check_dev_crypto()) | ||
371 | return (0); | ||
372 | |||
373 | if (ctx->cipher->iv_len > cryptodev_max_iv(cipher)) | 436 | if (ctx->cipher->iv_len > cryptodev_max_iv(cipher)) |
374 | return (0); | 437 | return (0); |
375 | 438 | ||
@@ -378,15 +441,18 @@ cryptodev_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | |||
378 | 441 | ||
379 | memset(sess, 0, sizeof(struct session_op)); | 442 | memset(sess, 0, sizeof(struct session_op)); |
380 | 443 | ||
444 | if ((state->d_fd = get_dev_crypto()) < 0) | ||
445 | return (0); | ||
446 | |||
381 | sess->key = (unsigned char *)key; | 447 | sess->key = (unsigned char *)key; |
382 | sess->keylen = ctx->key_len; | 448 | sess->keylen = ctx->key_len; |
383 | sess->cipher = cipher; | 449 | sess->cipher = cipher; |
384 | 450 | ||
385 | if (ioctl(cryptodev_fd, CIOCGSESSION, sess) == -1) { | 451 | if (ioctl(state->d_fd, CIOCGSESSION, sess) == -1) { |
386 | syslog_r(LOG_ERR, &sd, "CIOCGSESSION failed (%m)"); | 452 | close(state->d_fd); |
453 | state->d_fd = -1; | ||
387 | return (0); | 454 | return (0); |
388 | } | 455 | } |
389 | cryptodev_sessions++; | ||
390 | return (1); | 456 | return (1); |
391 | } | 457 | } |
392 | 458 | ||
@@ -394,14 +460,14 @@ cryptodev_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | |||
394 | * free anything we allocated earlier when initting a | 460 | * free anything we allocated earlier when initting a |
395 | * session, and close the session. | 461 | * session, and close the session. |
396 | */ | 462 | */ |
397 | int | 463 | static int |
398 | cryptodev_cleanup(EVP_CIPHER_CTX *ctx) | 464 | cryptodev_cleanup(EVP_CIPHER_CTX *ctx) |
399 | { | 465 | { |
400 | int ret = 0; | 466 | int ret = 0; |
401 | struct session_op *sess = ctx->cipher_data; | 467 | struct dev_crypto_state *state = ctx->cipher_data; |
402 | struct syslog_data sd = SYSLOG_DATA_INIT; | 468 | struct session_op *sess = &state->d_sess; |
403 | 469 | ||
404 | if (sess == NULL) | 470 | if (state->d_fd < 0) |
405 | return (0); | 471 | return (0); |
406 | 472 | ||
407 | /* XXX if this ioctl fails, someting's wrong. the invoker | 473 | /* XXX if this ioctl fails, someting's wrong. the invoker |
@@ -415,17 +481,14 @@ cryptodev_cleanup(EVP_CIPHER_CTX *ctx) | |||
415 | * print messages to users of the library. hmm.. | 481 | * print messages to users of the library. hmm.. |
416 | */ | 482 | */ |
417 | 483 | ||
418 | if (ioctl(cryptodev_fd, CIOCFSESSION, &sess->ses) == -1) { | 484 | if (ioctl(state->d_fd, CIOCFSESSION, &sess->ses) == -1) { |
419 | syslog_r(LOG_ERR, &sd, "CIOCFSESSION failed (%m)"); | ||
420 | ret = 0; | 485 | ret = 0; |
421 | } else { | 486 | } else { |
422 | cryptodev_sessions--; | ||
423 | ret = 1; | 487 | ret = 1; |
424 | } | 488 | } |
425 | if (cryptodev_sessions == 0 && cryptodev_fd != -1 ) { | 489 | close(state->d_fd); |
426 | close(cryptodev_fd); /* XXX should this be closed? */ | 490 | state->d_fd = -1; |
427 | cryptodev_fd = -1; | 491 | |
428 | } | ||
429 | return (ret); | 492 | return (ret); |
430 | } | 493 | } |
431 | 494 | ||
@@ -434,20 +497,6 @@ cryptodev_cleanup(EVP_CIPHER_CTX *ctx) | |||
434 | * gets called when libcrypto requests a cipher NID. | 497 | * gets called when libcrypto requests a cipher NID. |
435 | */ | 498 | */ |
436 | 499 | ||
437 | /* ARC4 (16 byte key) */ | ||
438 | const EVP_CIPHER cryptodev_arc4_cipher = { | ||
439 | NID_rc4, | ||
440 | 1, 16, 0, | ||
441 | EVP_CIPH_VARIABLE_LENGTH, | ||
442 | cryptodev_init_key, | ||
443 | cryptodev_cipher, | ||
444 | cryptodev_cleanup, | ||
445 | sizeof(struct session_op), | ||
446 | NULL, | ||
447 | NULL, | ||
448 | NULL | ||
449 | }; | ||
450 | |||
451 | /* DES CBC EVP */ | 500 | /* DES CBC EVP */ |
452 | const EVP_CIPHER cryptodev_des_cbc = { | 501 | const EVP_CIPHER cryptodev_des_cbc = { |
453 | NID_des_cbc, | 502 | NID_des_cbc, |
@@ -456,7 +505,7 @@ const EVP_CIPHER cryptodev_des_cbc = { | |||
456 | cryptodev_init_key, | 505 | cryptodev_init_key, |
457 | cryptodev_cipher, | 506 | cryptodev_cipher, |
458 | cryptodev_cleanup, | 507 | cryptodev_cleanup, |
459 | sizeof(struct session_op), | 508 | sizeof(struct dev_crypto_state), |
460 | EVP_CIPHER_set_asn1_iv, | 509 | EVP_CIPHER_set_asn1_iv, |
461 | EVP_CIPHER_get_asn1_iv, | 510 | EVP_CIPHER_get_asn1_iv, |
462 | NULL | 511 | NULL |
@@ -470,19 +519,57 @@ const EVP_CIPHER cryptodev_3des_cbc = { | |||
470 | cryptodev_init_key, | 519 | cryptodev_init_key, |
471 | cryptodev_cipher, | 520 | cryptodev_cipher, |
472 | cryptodev_cleanup, | 521 | cryptodev_cleanup, |
473 | sizeof(struct session_op), | 522 | sizeof(struct dev_crypto_state), |
523 | EVP_CIPHER_set_asn1_iv, | ||
524 | EVP_CIPHER_get_asn1_iv, | ||
525 | NULL | ||
526 | }; | ||
527 | |||
528 | const EVP_CIPHER cryptodev_bf_cbc = { | ||
529 | NID_bf_cbc, | ||
530 | 8, 16, 8, | ||
531 | EVP_CIPH_CBC_MODE, | ||
532 | cryptodev_init_key, | ||
533 | cryptodev_cipher, | ||
534 | cryptodev_cleanup, | ||
535 | sizeof(struct dev_crypto_state), | ||
536 | EVP_CIPHER_set_asn1_iv, | ||
537 | EVP_CIPHER_get_asn1_iv, | ||
538 | NULL | ||
539 | }; | ||
540 | |||
541 | const EVP_CIPHER cryptodev_cast_cbc = { | ||
542 | NID_cast5_cbc, | ||
543 | 8, 16, 8, | ||
544 | EVP_CIPH_CBC_MODE, | ||
545 | cryptodev_init_key, | ||
546 | cryptodev_cipher, | ||
547 | cryptodev_cleanup, | ||
548 | sizeof(struct dev_crypto_state), | ||
474 | EVP_CIPHER_set_asn1_iv, | 549 | EVP_CIPHER_set_asn1_iv, |
475 | EVP_CIPHER_get_asn1_iv, | 550 | EVP_CIPHER_get_asn1_iv, |
476 | NULL | 551 | NULL |
477 | }; | 552 | }; |
478 | 553 | ||
554 | const EVP_CIPHER cryptodev_aes_cbc = { | ||
555 | NID_aes_128_cbc, | ||
556 | 16, 16, 16, | ||
557 | EVP_CIPH_CBC_MODE, | ||
558 | cryptodev_init_key, | ||
559 | cryptodev_cipher, | ||
560 | cryptodev_cleanup, | ||
561 | sizeof(struct dev_crypto_state), | ||
562 | EVP_CIPHER_set_asn1_iv, | ||
563 | EVP_CIPHER_get_asn1_iv, | ||
564 | NULL | ||
565 | }; | ||
479 | 566 | ||
480 | /* | 567 | /* |
481 | * Registered by the ENGINE when used to find out how to deal with | 568 | * Registered by the ENGINE when used to find out how to deal with |
482 | * a particular NID in the ENGINE. this says what we'll do at the | 569 | * a particular NID in the ENGINE. this says what we'll do at the |
483 | * top level - note, that list is restricted by what we answer with | 570 | * top level - note, that list is restricted by what we answer with |
484 | */ | 571 | */ |
485 | int | 572 | static int |
486 | cryptodev_engine_ciphers(ENGINE *e, const EVP_CIPHER **cipher, | 573 | cryptodev_engine_ciphers(ENGINE *e, const EVP_CIPHER **cipher, |
487 | const int **nids, int nid) | 574 | const int **nids, int nid) |
488 | { | 575 | { |
@@ -490,15 +577,21 @@ cryptodev_engine_ciphers(ENGINE *e, const EVP_CIPHER **cipher, | |||
490 | return (cryptodev_usable_ciphers(nids)); | 577 | return (cryptodev_usable_ciphers(nids)); |
491 | 578 | ||
492 | switch (nid) { | 579 | switch (nid) { |
493 | case NID_rc4: | ||
494 | *cipher = &cryptodev_arc4_cipher; | ||
495 | break; | ||
496 | case NID_des_ede3_cbc: | 580 | case NID_des_ede3_cbc: |
497 | *cipher = &cryptodev_3des_cbc; | 581 | *cipher = &cryptodev_3des_cbc; |
498 | break; | 582 | break; |
499 | case NID_des_cbc: | 583 | case NID_des_cbc: |
500 | *cipher = &cryptodev_des_cbc; | 584 | *cipher = &cryptodev_des_cbc; |
501 | break; | 585 | break; |
586 | case NID_bf_cbc: | ||
587 | *cipher = &cryptodev_bf_cbc; | ||
588 | break; | ||
589 | case NID_cast5_cbc: | ||
590 | *cipher = &cryptodev_cast_cbc; | ||
591 | break; | ||
592 | case NID_aes_128_cbc: | ||
593 | *cipher = &cryptodev_aes_cbc; | ||
594 | break; | ||
502 | default: | 595 | default: |
503 | *cipher = NULL; | 596 | *cipher = NULL; |
504 | break; | 597 | break; |
@@ -506,7 +599,7 @@ cryptodev_engine_ciphers(ENGINE *e, const EVP_CIPHER **cipher, | |||
506 | return (*cipher != NULL); | 599 | return (*cipher != NULL); |
507 | } | 600 | } |
508 | 601 | ||
509 | int | 602 | static int |
510 | cryptodev_engine_digests(ENGINE *e, const EVP_MD **digest, | 603 | cryptodev_engine_digests(ENGINE *e, const EVP_MD **digest, |
511 | const int **nids, int nid) | 604 | const int **nids, int nid) |
512 | { | 605 | { |
@@ -524,7 +617,6 @@ cryptodev_engine_digests(ENGINE *e, const EVP_MD **digest, | |||
524 | return (*digest != NULL); | 617 | return (*digest != NULL); |
525 | } | 618 | } |
526 | 619 | ||
527 | |||
528 | /* | 620 | /* |
529 | * Convert a BIGNUM to the representation that /dev/crypto needs. | 621 | * Convert a BIGNUM to the representation that /dev/crypto needs. |
530 | * Upon completion of use, the caller is responsible for freeing | 622 | * Upon completion of use, the caller is responsible for freeing |
@@ -533,7 +625,7 @@ cryptodev_engine_digests(ENGINE *e, const EVP_MD **digest, | |||
533 | static int | 625 | static int |
534 | bn2crparam(const BIGNUM *a, struct crparam *crp) | 626 | bn2crparam(const BIGNUM *a, struct crparam *crp) |
535 | { | 627 | { |
536 | int i, j, n; | 628 | int i, j, k; |
537 | ssize_t words, bytes, bits; | 629 | ssize_t words, bytes, bits; |
538 | u_char *b; | 630 | u_char *b; |
539 | 631 | ||
@@ -550,17 +642,13 @@ bn2crparam(const BIGNUM *a, struct crparam *crp) | |||
550 | crp->crp_p = b; | 642 | crp->crp_p = b; |
551 | crp->crp_nbits = bits; | 643 | crp->crp_nbits = bits; |
552 | 644 | ||
553 | words = (bits + BN_BITS2 - 1) / BN_BITS2; | 645 | for (i = 0, j = 0; i < a->top; i++) { |
554 | 646 | for (k = 0; k < BN_BITS2 / 8; k++) { | |
555 | n = 0; | 647 | if ((j + k) >= bytes) |
556 | for (i = 0; i < words && n < bytes; i++) { | 648 | return (0); |
557 | BN_ULONG word; | 649 | b[j + k] = a->d[i] >> (k * 8); |
558 | |||
559 | word = a->d[i]; | ||
560 | for (j = 0 ; j < BN_BYTES && n < bytes; j++, n++) { | ||
561 | *b++ = (word & 0xff); | ||
562 | word >>= 8; | ||
563 | } | 650 | } |
651 | j += BN_BITS2 / 8; | ||
564 | } | 652 | } |
565 | return (0); | 653 | return (0); |
566 | } | 654 | } |
@@ -569,15 +657,22 @@ bn2crparam(const BIGNUM *a, struct crparam *crp) | |||
569 | static int | 657 | static int |
570 | crparam2bn(struct crparam *crp, BIGNUM *a) | 658 | crparam2bn(struct crparam *crp, BIGNUM *a) |
571 | { | 659 | { |
660 | u_int8_t *pd; | ||
572 | int i, bytes; | 661 | int i, bytes; |
573 | 662 | ||
574 | bytes = (crp->crp_nbits + 7)/8; | 663 | bytes = (crp->crp_nbits + 7) / 8; |
575 | 664 | ||
576 | BN_zero(a); | 665 | if (bytes == 0) |
577 | for (i = bytes - 1; i >= 0; i--) { | 666 | return (-1); |
578 | BN_lshift(a, a, 8); | 667 | |
579 | BN_add_word(a, (u_char)crp->crp_p[i]); | 668 | if ((pd = (u_int8_t *) malloc(bytes)) == NULL) |
580 | } | 669 | return (-1); |
670 | |||
671 | for (i = 0; i < bytes; i++) | ||
672 | pd[i] = crp->crp_p[bytes - i - 1]; | ||
673 | |||
674 | BN_bin2bn(pd, bytes, a); | ||
675 | free(pd); | ||
581 | 676 | ||
582 | return (0); | 677 | return (0); |
583 | } | 678 | } |
@@ -596,25 +691,32 @@ zapparams(struct crypt_kop *kop) | |||
596 | } | 691 | } |
597 | 692 | ||
598 | static int | 693 | static int |
599 | cryptodev_sym(struct crypt_kop *kop, BIGNUM *r, BIGNUM *s) | 694 | cryptodev_asym(struct crypt_kop *kop, int rlen, BIGNUM *r, int slen, BIGNUM *s) |
600 | { | 695 | { |
601 | int ret = -1; | 696 | int fd, ret = -1; |
697 | |||
698 | if ((fd = get_asym_dev_crypto()) < 0) | ||
699 | return (ret); | ||
602 | 700 | ||
603 | if (r) { | 701 | if (r) { |
604 | kop->crk_param[kop->crk_iparams].crp_p = malloc(256); | 702 | kop->crk_param[kop->crk_iparams].crp_p = calloc(rlen, sizeof(char)); |
605 | kop->crk_param[kop->crk_iparams].crp_nbits = 256 * 8; | 703 | kop->crk_param[kop->crk_iparams].crp_nbits = rlen * 8; |
606 | kop->crk_oparams++; | 704 | kop->crk_oparams++; |
607 | } | 705 | } |
608 | if (s) { | 706 | if (s) { |
609 | kop->crk_param[kop->crk_iparams+1].crp_p = malloc(256); | 707 | kop->crk_param[kop->crk_iparams+1].crp_p = calloc(slen, sizeof(char)); |
610 | kop->crk_param[kop->crk_iparams+1].crp_nbits = 256 * 8; | 708 | kop->crk_param[kop->crk_iparams+1].crp_nbits = slen * 8; |
611 | kop->crk_oparams++; | 709 | kop->crk_oparams++; |
612 | } | 710 | } |
613 | 711 | ||
614 | if (ioctl(cryptodev_fd, CIOCKEY, &kop) == 0) { | 712 | if (ioctl(fd, CIOCKEY, kop) == 0) { |
615 | crparam2bn(&kop->crk_param[3], r); | 713 | if (r) |
714 | crparam2bn(&kop->crk_param[kop->crk_iparams], r); | ||
715 | if (s) | ||
716 | crparam2bn(&kop->crk_param[kop->crk_iparams+1], s); | ||
616 | ret = 0; | 717 | ret = 0; |
617 | } | 718 | } |
719 | |||
618 | return (ret); | 720 | return (ret); |
619 | } | 721 | } |
620 | 722 | ||
@@ -623,38 +725,58 @@ cryptodev_bn_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, | |||
623 | const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont) | 725 | const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont) |
624 | { | 726 | { |
625 | struct crypt_kop kop; | 727 | struct crypt_kop kop; |
626 | int ret = 0; | 728 | int ret = 1; |
729 | |||
730 | /* Currently, we know we can do mod exp iff we can do any | ||
731 | * asymmetric operations at all. | ||
732 | */ | ||
733 | if (cryptodev_asymfeat == 0) { | ||
734 | ret = BN_mod_exp(r, a, p, m, ctx); | ||
735 | return (ret); | ||
736 | } | ||
627 | 737 | ||
628 | memset(&kop, 0, sizeof kop); | 738 | memset(&kop, 0, sizeof kop); |
629 | kop.crk_op = CRK_MOD_EXP; | 739 | kop.crk_op = CRK_MOD_EXP; |
630 | 740 | ||
631 | /* inputs: a m p */ | 741 | /* inputs: a^p % m */ |
632 | if (bn2crparam(a, &kop.crk_param[0])) | 742 | if (bn2crparam(a, &kop.crk_param[0])) |
633 | goto err; | 743 | goto err; |
634 | if (bn2crparam(m, &kop.crk_param[1])) | 744 | if (bn2crparam(p, &kop.crk_param[1])) |
635 | goto err; | 745 | goto err; |
636 | if (bn2crparam(p, &kop.crk_param[2])) | 746 | if (bn2crparam(m, &kop.crk_param[2])) |
637 | goto err; | 747 | goto err; |
638 | kop.crk_iparams = 3; | 748 | kop.crk_iparams = 3; |
639 | 749 | ||
640 | if (cryptodev_sym(&kop, r, NULL) == -1) { | 750 | if (cryptodev_asym(&kop, BN_num_bytes(m), r, 0, NULL) == -1) { |
641 | ret = BN_mod_exp(r, a, p, m, ctx); | 751 | const RSA_METHOD *meth = RSA_PKCS1_SSLeay(); |
752 | ret = meth->bn_mod_exp(r, a, p, m, ctx, in_mont); | ||
642 | } | 753 | } |
643 | err: | 754 | err: |
644 | zapparams(&kop); | 755 | zapparams(&kop); |
645 | return (ret); | 756 | return (ret); |
646 | } | 757 | } |
647 | 758 | ||
759 | static int | ||
760 | cryptodev_rsa_nocrt_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa) | ||
761 | { | ||
762 | int r; | ||
763 | BN_CTX *ctx; | ||
764 | |||
765 | ctx = BN_CTX_new(); | ||
766 | r = cryptodev_bn_mod_exp(r0, I, rsa->d, rsa->n, ctx, NULL); | ||
767 | BN_CTX_free(ctx); | ||
768 | return (r); | ||
769 | } | ||
648 | 770 | ||
649 | static int | 771 | static int |
650 | cryptodev_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa) | 772 | cryptodev_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa) |
651 | { | 773 | { |
652 | struct crypt_kop kop; | 774 | struct crypt_kop kop; |
653 | int ret = 0; | 775 | int ret = 1; |
654 | 776 | ||
655 | if (!rsa->p || !rsa->q || !rsa->dmp1 || !rsa->dmq1 || !rsa->iqmp) { | 777 | if (!rsa->p || !rsa->q || !rsa->dmp1 || !rsa->dmq1 || !rsa->iqmp) { |
656 | /* XXX 0 means failure?? */ | 778 | /* XXX 0 means failure?? */ |
657 | goto err; | 779 | return (0); |
658 | } | 780 | } |
659 | 781 | ||
660 | memset(&kop, 0, sizeof kop); | 782 | memset(&kop, 0, sizeof kop); |
@@ -674,9 +796,8 @@ cryptodev_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa) | |||
674 | goto err; | 796 | goto err; |
675 | kop.crk_iparams = 6; | 797 | kop.crk_iparams = 6; |
676 | 798 | ||
677 | if (cryptodev_sym(&kop, r0, NULL) == -1) { | 799 | if (cryptodev_asym(&kop, BN_num_bytes(rsa->n), r0, 0, NULL) == -1) { |
678 | const RSA_METHOD *meth = RSA_PKCS1_SSLeay(); | 800 | const RSA_METHOD *meth = RSA_PKCS1_SSLeay(); |
679 | |||
680 | ret = (*meth->rsa_mod_exp)(r0, I, rsa); | 801 | ret = (*meth->rsa_mod_exp)(r0, I, rsa); |
681 | } | 802 | } |
682 | err: | 803 | err: |
@@ -690,8 +811,8 @@ static RSA_METHOD cryptodev_rsa = { | |||
690 | NULL, /* rsa_pub_dec */ | 811 | NULL, /* rsa_pub_dec */ |
691 | NULL, /* rsa_priv_enc */ | 812 | NULL, /* rsa_priv_enc */ |
692 | NULL, /* rsa_priv_dec */ | 813 | NULL, /* rsa_priv_dec */ |
693 | cryptodev_rsa_mod_exp, /* rsa_mod_exp */ | 814 | NULL, |
694 | cryptodev_bn_mod_exp, /* bn_mod_exp */ | 815 | NULL, |
695 | NULL, /* init */ | 816 | NULL, /* init */ |
696 | NULL, /* finish */ | 817 | NULL, /* finish */ |
697 | 0, /* flags */ | 818 | 0, /* flags */ |
@@ -707,6 +828,38 @@ cryptodev_dsa_bn_mod_exp(DSA *dsa, BIGNUM *r, BIGNUM *a, const BIGNUM *p, | |||
707 | return (cryptodev_bn_mod_exp(r, a, p, m, ctx, m_ctx)); | 828 | return (cryptodev_bn_mod_exp(r, a, p, m, ctx, m_ctx)); |
708 | } | 829 | } |
709 | 830 | ||
831 | static int | ||
832 | cryptodev_dsa_dsa_mod_exp(DSA *dsa, BIGNUM *t1, BIGNUM *g, | ||
833 | BIGNUM *u1, BIGNUM *pub_key, BIGNUM *u2, BIGNUM *p, | ||
834 | BN_CTX *ctx, BN_MONT_CTX *mont) | ||
835 | { | ||
836 | BIGNUM t2; | ||
837 | int ret = 0; | ||
838 | |||
839 | BN_init(&t2); | ||
840 | |||
841 | /* v = ( g^u1 * y^u2 mod p ) mod q */ | ||
842 | /* let t1 = g ^ u1 mod p */ | ||
843 | ret = 0; | ||
844 | |||
845 | if (!dsa->meth->bn_mod_exp(dsa,t1,dsa->g,u1,dsa->p,ctx,mont)) | ||
846 | goto err; | ||
847 | |||
848 | /* let t2 = y ^ u2 mod p */ | ||
849 | if (!dsa->meth->bn_mod_exp(dsa,&t2,dsa->pub_key,u2,dsa->p,ctx,mont)) | ||
850 | goto err; | ||
851 | /* let u1 = t1 * t2 mod p */ | ||
852 | if (!BN_mod_mul(u1,t1,&t2,dsa->p,ctx)) | ||
853 | goto err; | ||
854 | |||
855 | BN_copy(t1,u1); | ||
856 | |||
857 | ret = 1; | ||
858 | err: | ||
859 | BN_free(&t2); | ||
860 | return(ret); | ||
861 | } | ||
862 | |||
710 | static DSA_SIG * | 863 | static DSA_SIG * |
711 | cryptodev_dsa_do_sign(const unsigned char *dgst, int dlen, DSA *dsa) | 864 | cryptodev_dsa_do_sign(const unsigned char *dgst, int dlen, DSA *dsa) |
712 | { | 865 | { |
@@ -721,6 +874,7 @@ cryptodev_dsa_do_sign(const unsigned char *dgst, int dlen, DSA *dsa) | |||
721 | goto err; | 874 | goto err; |
722 | } | 875 | } |
723 | 876 | ||
877 | printf("bar\n"); | ||
724 | memset(&kop, 0, sizeof kop); | 878 | memset(&kop, 0, sizeof kop); |
725 | kop.crk_op = CRK_DSA_SIGN; | 879 | kop.crk_op = CRK_DSA_SIGN; |
726 | 880 | ||
@@ -737,13 +891,13 @@ cryptodev_dsa_do_sign(const unsigned char *dgst, int dlen, DSA *dsa) | |||
737 | goto err; | 891 | goto err; |
738 | kop.crk_iparams = 5; | 892 | kop.crk_iparams = 5; |
739 | 893 | ||
740 | if (cryptodev_sym(&kop, r, s) == 0) { | 894 | if (cryptodev_asym(&kop, BN_num_bytes(dsa->q), r, |
895 | BN_num_bytes(dsa->q), s) == 0) { | ||
741 | dsaret = DSA_SIG_new(); | 896 | dsaret = DSA_SIG_new(); |
742 | dsaret->r = r; | 897 | dsaret->r = r; |
743 | dsaret->s = s; | 898 | dsaret->s = s; |
744 | } else { | 899 | } else { |
745 | const DSA_METHOD *meth = DSA_OpenSSL(); | 900 | const DSA_METHOD *meth = DSA_OpenSSL(); |
746 | |||
747 | BN_free(r); | 901 | BN_free(r); |
748 | BN_free(s); | 902 | BN_free(s); |
749 | dsaret = (meth->dsa_do_sign)(dgst, dlen, dsa); | 903 | dsaret = (meth->dsa_do_sign)(dgst, dlen, dsa); |
@@ -759,7 +913,7 @@ cryptodev_dsa_verify(const unsigned char *dgst, int dlen, | |||
759 | DSA_SIG *sig, DSA *dsa) | 913 | DSA_SIG *sig, DSA *dsa) |
760 | { | 914 | { |
761 | struct crypt_kop kop; | 915 | struct crypt_kop kop; |
762 | int dsaret = 0; | 916 | int dsaret = 1; |
763 | 917 | ||
764 | memset(&kop, 0, sizeof kop); | 918 | memset(&kop, 0, sizeof kop); |
765 | kop.crk_op = CRK_DSA_VERIFY; | 919 | kop.crk_op = CRK_DSA_VERIFY; |
@@ -781,7 +935,7 @@ cryptodev_dsa_verify(const unsigned char *dgst, int dlen, | |||
781 | goto err; | 935 | goto err; |
782 | kop.crk_iparams = 7; | 936 | kop.crk_iparams = 7; |
783 | 937 | ||
784 | if (cryptodev_sym(&kop, NULL, NULL) == 0) { | 938 | if (cryptodev_asym(&kop, 0, NULL, 0, NULL) == 0) { |
785 | dsaret = kop.crk_status; | 939 | dsaret = kop.crk_status; |
786 | } else { | 940 | } else { |
787 | const DSA_METHOD *meth = DSA_OpenSSL(); | 941 | const DSA_METHOD *meth = DSA_OpenSSL(); |
@@ -796,11 +950,11 @@ err: | |||
796 | 950 | ||
797 | static DSA_METHOD cryptodev_dsa = { | 951 | static DSA_METHOD cryptodev_dsa = { |
798 | "cryptodev DSA method", | 952 | "cryptodev DSA method", |
799 | cryptodev_dsa_do_sign, | 953 | NULL, |
800 | NULL, /* dsa_sign_setup */ | 954 | NULL, /* dsa_sign_setup */ |
801 | cryptodev_dsa_verify, | 955 | NULL, |
802 | NULL, /* dsa_mod_exp */ | 956 | NULL, /* dsa_mod_exp */ |
803 | cryptodev_dsa_bn_mod_exp, /* bn_mod_exp */ | 957 | NULL, |
804 | NULL, /* init */ | 958 | NULL, /* init */ |
805 | NULL, /* finish */ | 959 | NULL, /* finish */ |
806 | 0, /* flags */ | 960 | 0, /* flags */ |
@@ -819,8 +973,14 @@ static int | |||
819 | cryptodev_dh_compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh) | 973 | cryptodev_dh_compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh) |
820 | { | 974 | { |
821 | struct crypt_kop kop; | 975 | struct crypt_kop kop; |
822 | int dhret = 0; | 976 | int dhret = 1; |
823 | int keylen; | 977 | int fd, keylen; |
978 | |||
979 | if ((fd = get_asym_dev_crypto()) < 0) { | ||
980 | const DH_METHOD *meth = DH_OpenSSL(); | ||
981 | |||
982 | return ((meth->compute_key)(key, pub_key, dh)); | ||
983 | } | ||
824 | 984 | ||
825 | keylen = BN_num_bits(dh->p); | 985 | keylen = BN_num_bits(dh->p); |
826 | 986 | ||
@@ -840,7 +1000,7 @@ cryptodev_dh_compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh) | |||
840 | kop.crk_param[3].crp_nbits = keylen * 8; | 1000 | kop.crk_param[3].crp_nbits = keylen * 8; |
841 | kop.crk_oparams = 1; | 1001 | kop.crk_oparams = 1; |
842 | 1002 | ||
843 | if (ioctl(cryptodev_fd, CIOCKEY, &kop) == -1) { | 1003 | if (ioctl(fd, CIOCKEY, &kop) == -1) { |
844 | const DH_METHOD *meth = DH_OpenSSL(); | 1004 | const DH_METHOD *meth = DH_OpenSSL(); |
845 | 1005 | ||
846 | dhret = (meth->compute_key)(key, pub_key, dh); | 1006 | dhret = (meth->compute_key)(key, pub_key, dh); |
@@ -854,8 +1014,8 @@ err: | |||
854 | static DH_METHOD cryptodev_dh = { | 1014 | static DH_METHOD cryptodev_dh = { |
855 | "cryptodev DH method", | 1015 | "cryptodev DH method", |
856 | NULL, /* cryptodev_dh_generate_key */ | 1016 | NULL, /* cryptodev_dh_generate_key */ |
857 | cryptodev_dh_compute_key, | 1017 | NULL, |
858 | cryptodev_mod_exp_dh, | 1018 | NULL, |
859 | NULL, | 1019 | NULL, |
860 | NULL, | 1020 | NULL, |
861 | 0, /* flags */ | 1021 | 0, /* flags */ |
@@ -869,12 +1029,18 @@ static DH_METHOD cryptodev_dh = { | |||
869 | static int | 1029 | static int |
870 | cryptodev_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)()) | 1030 | cryptodev_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)()) |
871 | { | 1031 | { |
1032 | #ifdef HAVE_SYSLOG_R | ||
872 | struct syslog_data sd = SYSLOG_DATA_INIT; | 1033 | struct syslog_data sd = SYSLOG_DATA_INIT; |
1034 | #endif | ||
873 | 1035 | ||
874 | switch (cmd) { | 1036 | switch (cmd) { |
875 | default: | 1037 | default: |
1038 | #ifdef HAVE_SYSLOG_R | ||
876 | syslog_r(LOG_ERR, &sd, | 1039 | syslog_r(LOG_ERR, &sd, |
877 | "cryptodev_ctrl: unknown command %d", cmd); | 1040 | "cryptodev_ctrl: unknown command %d", cmd); |
1041 | #else | ||
1042 | syslog(LOG_ERR, "cryptodev_ctrl: unknown command %d", cmd); | ||
1043 | #endif | ||
878 | break; | 1044 | break; |
879 | } | 1045 | } |
880 | return (1); | 1046 | return (1); |
@@ -884,14 +1050,24 @@ void | |||
884 | ENGINE_load_cryptodev(void) | 1050 | ENGINE_load_cryptodev(void) |
885 | { | 1051 | { |
886 | ENGINE *engine = ENGINE_new(); | 1052 | ENGINE *engine = ENGINE_new(); |
887 | const RSA_METHOD *rsa_meth; | 1053 | int fd; |
888 | const DH_METHOD *dh_meth; | ||
889 | 1054 | ||
890 | if (engine == NULL) | 1055 | if (engine == NULL) |
891 | return; | 1056 | return; |
1057 | if ((fd = get_dev_crypto()) < 0) | ||
1058 | return; | ||
1059 | |||
1060 | /* | ||
1061 | * find out what asymmetric crypto algorithms we support | ||
1062 | */ | ||
1063 | if (ioctl(fd, CIOCASYMFEAT, &cryptodev_asymfeat) == -1) { | ||
1064 | close(fd); | ||
1065 | return; | ||
1066 | } | ||
1067 | close(fd); | ||
892 | 1068 | ||
893 | if (!ENGINE_set_id(engine, "cryptodev") || | 1069 | if (!ENGINE_set_id(engine, "cryptodev") || |
894 | !ENGINE_set_name(engine, "OpenBSD cryptodev engine") || | 1070 | !ENGINE_set_name(engine, "BSD cryptodev engine") || |
895 | !ENGINE_set_ciphers(engine, cryptodev_engine_ciphers) || | 1071 | !ENGINE_set_ciphers(engine, cryptodev_engine_ciphers) || |
896 | !ENGINE_set_digests(engine, cryptodev_engine_digests) || | 1072 | !ENGINE_set_digests(engine, cryptodev_engine_digests) || |
897 | !ENGINE_set_ctrl_function(engine, cryptodev_ctrl) || | 1073 | !ENGINE_set_ctrl_function(engine, cryptodev_ctrl) || |
@@ -900,27 +1076,57 @@ ENGINE_load_cryptodev(void) | |||
900 | return; | 1076 | return; |
901 | } | 1077 | } |
902 | 1078 | ||
903 | if ((cryptodev_symfeat & CRSFEAT_RSA) && | 1079 | if (ENGINE_set_RSA(engine, &cryptodev_rsa)) { |
904 | ENGINE_set_RSA(engine, &cryptodev_rsa)) { | 1080 | const RSA_METHOD *rsa_meth = RSA_PKCS1_SSLeay(); |
905 | rsa_meth = RSA_PKCS1_SSLeay(); | 1081 | |
1082 | cryptodev_rsa.bn_mod_exp = rsa_meth->bn_mod_exp; | ||
1083 | cryptodev_rsa.rsa_mod_exp = rsa_meth->rsa_mod_exp; | ||
906 | cryptodev_rsa.rsa_pub_enc = rsa_meth->rsa_pub_enc; | 1084 | cryptodev_rsa.rsa_pub_enc = rsa_meth->rsa_pub_enc; |
907 | cryptodev_rsa.rsa_pub_dec = rsa_meth->rsa_pub_dec; | 1085 | cryptodev_rsa.rsa_pub_dec = rsa_meth->rsa_pub_dec; |
908 | cryptodev_rsa.rsa_priv_enc = rsa_meth->rsa_priv_dec; | 1086 | cryptodev_rsa.rsa_priv_enc = rsa_meth->rsa_priv_enc; |
909 | cryptodev_rsa.rsa_priv_dec = rsa_meth->rsa_priv_dec; | 1087 | cryptodev_rsa.rsa_priv_dec = rsa_meth->rsa_priv_dec; |
1088 | if (cryptodev_asymfeat & CRF_MOD_EXP) { | ||
1089 | cryptodev_rsa.bn_mod_exp = cryptodev_bn_mod_exp; | ||
1090 | if (cryptodev_asymfeat & CRF_MOD_EXP_CRT) | ||
1091 | cryptodev_rsa.rsa_mod_exp = | ||
1092 | cryptodev_rsa_mod_exp; | ||
1093 | else | ||
1094 | cryptodev_rsa.rsa_mod_exp = | ||
1095 | cryptodev_rsa_nocrt_mod_exp; | ||
1096 | } | ||
910 | } | 1097 | } |
911 | 1098 | ||
912 | if ((cryptodev_symfeat & CRSFEAT_DSA) && | 1099 | if (ENGINE_set_DSA(engine, &cryptodev_dsa)) { |
913 | ENGINE_set_DSA(engine, &cryptodev_dsa)) { | 1100 | const DSA_METHOD *meth = DSA_OpenSSL(); |
1101 | |||
1102 | memcpy(&cryptodev_dsa, meth, sizeof(DSA_METHOD)); | ||
1103 | if (cryptodev_asymfeat & CRF_DSA_SIGN) | ||
1104 | cryptodev_dsa.dsa_do_sign = cryptodev_dsa_do_sign; | ||
1105 | if (cryptodev_asymfeat & CRF_MOD_EXP) { | ||
1106 | cryptodev_dsa.bn_mod_exp = cryptodev_dsa_bn_mod_exp; | ||
1107 | cryptodev_dsa.dsa_mod_exp = cryptodev_dsa_dsa_mod_exp; | ||
1108 | } | ||
1109 | if (cryptodev_asymfeat & CRF_DSA_VERIFY) | ||
1110 | cryptodev_dsa.dsa_do_verify = cryptodev_dsa_verify; | ||
914 | } | 1111 | } |
915 | 1112 | ||
916 | if ((cryptodev_symfeat & CRSFEAT_DH) && | 1113 | if (ENGINE_set_DH(engine, &cryptodev_dh)){ |
917 | ENGINE_set_DH(engine, &cryptodev_dh)) { | 1114 | const DH_METHOD *dh_meth = DH_OpenSSL(); |
918 | dh_meth = DH_OpenSSL(); | 1115 | |
919 | cryptodev_dh.generate_key = dh_meth->generate_key; | 1116 | cryptodev_dh.generate_key = dh_meth->generate_key; |
920 | cryptodev_dh.compute_key = dh_meth->compute_key; | 1117 | cryptodev_dh.compute_key = dh_meth->compute_key; |
1118 | cryptodev_dh.bn_mod_exp = dh_meth->bn_mod_exp; | ||
1119 | if (cryptodev_asymfeat & CRF_MOD_EXP) { | ||
1120 | cryptodev_dh.bn_mod_exp = cryptodev_mod_exp_dh; | ||
1121 | if (cryptodev_asymfeat & CRF_DH_COMPUTE_KEY) | ||
1122 | cryptodev_dh.compute_key = | ||
1123 | cryptodev_dh_compute_key; | ||
1124 | } | ||
921 | } | 1125 | } |
922 | 1126 | ||
923 | ENGINE_add(engine); | 1127 | ENGINE_add(engine); |
924 | ENGINE_free(engine); | 1128 | ENGINE_free(engine); |
925 | ERR_clear_error(); | 1129 | ERR_clear_error(); |
926 | } | 1130 | } |
1131 | |||
1132 | #endif /* HAVE_CRYPTODEV */ | ||
diff --git a/src/lib/libcrypto/engine/hw_cswift.c b/src/lib/libcrypto/engine/hw_cswift.c index f5c897bdbb..f128ee5a68 100644 --- a/src/lib/libcrypto/engine/hw_cswift.c +++ b/src/lib/libcrypto/engine/hw_cswift.c | |||
@@ -121,6 +121,10 @@ static int cswift_mod_exp_dh(const DH *dh, BIGNUM *r, | |||
121 | const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); | 121 | const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); |
122 | #endif | 122 | #endif |
123 | 123 | ||
124 | /* RAND stuff */ | ||
125 | static int cswift_rand_bytes(unsigned char *buf, int num); | ||
126 | static int cswift_rand_status(void); | ||
127 | |||
124 | /* The definitions for control commands specific to this engine */ | 128 | /* The definitions for control commands specific to this engine */ |
125 | #define CSWIFT_CMD_SO_PATH ENGINE_CMD_BASE | 129 | #define CSWIFT_CMD_SO_PATH ENGINE_CMD_BASE |
126 | static const ENGINE_CMD_DEFN cswift_cmd_defns[] = { | 130 | static const ENGINE_CMD_DEFN cswift_cmd_defns[] = { |
@@ -183,6 +187,18 @@ static DH_METHOD cswift_dh = | |||
183 | }; | 187 | }; |
184 | #endif | 188 | #endif |
185 | 189 | ||
190 | static RAND_METHOD cswift_random = | ||
191 | { | ||
192 | /* "CryptoSwift RAND method", */ | ||
193 | NULL, | ||
194 | cswift_rand_bytes, | ||
195 | NULL, | ||
196 | NULL, | ||
197 | cswift_rand_bytes, | ||
198 | cswift_rand_status, | ||
199 | }; | ||
200 | |||
201 | |||
186 | /* Constants used when creating the ENGINE */ | 202 | /* Constants used when creating the ENGINE */ |
187 | static const char *engine_cswift_id = "cswift"; | 203 | static const char *engine_cswift_id = "cswift"; |
188 | static const char *engine_cswift_name = "CryptoSwift hardware engine support"; | 204 | static const char *engine_cswift_name = "CryptoSwift hardware engine support"; |
@@ -208,6 +224,7 @@ static int bind_helper(ENGINE *e) | |||
208 | #ifndef OPENSSL_NO_DH | 224 | #ifndef OPENSSL_NO_DH |
209 | !ENGINE_set_DH(e, &cswift_dh) || | 225 | !ENGINE_set_DH(e, &cswift_dh) || |
210 | #endif | 226 | #endif |
227 | !ENGINE_set_RAND(e, &cswift_random) || | ||
211 | !ENGINE_set_destroy_function(e, cswift_destroy) || | 228 | !ENGINE_set_destroy_function(e, cswift_destroy) || |
212 | !ENGINE_set_init_function(e, cswift_init) || | 229 | !ENGINE_set_init_function(e, cswift_init) || |
213 | !ENGINE_set_finish_function(e, cswift_finish) || | 230 | !ENGINE_set_finish_function(e, cswift_finish) || |
@@ -242,6 +259,7 @@ static int bind_helper(ENGINE *e) | |||
242 | return 1; | 259 | return 1; |
243 | } | 260 | } |
244 | 261 | ||
262 | #ifndef ENGINE_DYNAMIC_SUPPORT | ||
245 | static ENGINE *engine_cswift(void) | 263 | static ENGINE *engine_cswift(void) |
246 | { | 264 | { |
247 | ENGINE *ret = ENGINE_new(); | 265 | ENGINE *ret = ENGINE_new(); |
@@ -264,6 +282,7 @@ void ENGINE_load_cswift(void) | |||
264 | ENGINE_free(toadd); | 282 | ENGINE_free(toadd); |
265 | ERR_clear_error(); | 283 | ERR_clear_error(); |
266 | } | 284 | } |
285 | #endif | ||
267 | 286 | ||
268 | /* This is a process-global DSO handle used for loading and unloading | 287 | /* This is a process-global DSO handle used for loading and unloading |
269 | * the CryptoSwift library. NB: This is only set (or unset) during an | 288 | * the CryptoSwift library. NB: This is only set (or unset) during an |
@@ -905,6 +924,60 @@ static int cswift_mod_exp_dh(const DH *dh, BIGNUM *r, | |||
905 | } | 924 | } |
906 | #endif | 925 | #endif |
907 | 926 | ||
927 | /* Random bytes are good */ | ||
928 | static int cswift_rand_bytes(unsigned char *buf, int num) | ||
929 | { | ||
930 | SW_CONTEXT_HANDLE hac; | ||
931 | SW_STATUS swrc; | ||
932 | SW_LARGENUMBER largenum; | ||
933 | size_t nbytes = 0; | ||
934 | int acquired = 0; | ||
935 | int to_return = 0; /* assume failure */ | ||
936 | |||
937 | if (!get_context(&hac)) | ||
938 | { | ||
939 | CSWIFTerr(CSWIFT_F_CSWIFT_CTRL, CSWIFT_R_UNIT_FAILURE); | ||
940 | goto err; | ||
941 | } | ||
942 | acquired = 1; | ||
943 | |||
944 | while (nbytes < (size_t)num) | ||
945 | { | ||
946 | /* tell CryptoSwift how many bytes we want and where we want it. | ||
947 | * Note: - CryptoSwift cannot do more than 4096 bytes at a time. | ||
948 | * - CryptoSwift can only do multiple of 32-bits. */ | ||
949 | largenum.value = (SW_BYTE *) buf + nbytes; | ||
950 | if (4096 > num - nbytes) | ||
951 | largenum.nbytes = num - nbytes; | ||
952 | else | ||
953 | largenum.nbytes = 4096; | ||
954 | |||
955 | swrc = p_CSwift_SimpleRequest(hac, SW_CMD_RAND, NULL, 0, &largenum, 1); | ||
956 | if (swrc != SW_OK) | ||
957 | { | ||
958 | char tmpbuf[20]; | ||
959 | CSWIFTerr(CSWIFT_F_CSWIFT_CTRL, CSWIFT_R_REQUEST_FAILED); | ||
960 | sprintf(tmpbuf, "%ld", swrc); | ||
961 | ERR_add_error_data(2, "CryptoSwift error number is ", tmpbuf); | ||
962 | goto err; | ||
963 | } | ||
964 | |||
965 | nbytes += largenum.nbytes; | ||
966 | } | ||
967 | to_return = 1; /* success */ | ||
968 | |||
969 | err: | ||
970 | if (acquired) | ||
971 | release_context(hac); | ||
972 | return to_return; | ||
973 | } | ||
974 | |||
975 | static int cswift_rand_status(void) | ||
976 | { | ||
977 | return 1; | ||
978 | } | ||
979 | |||
980 | |||
908 | /* This stuff is needed if this ENGINE is being compiled into a self-contained | 981 | /* This stuff is needed if this ENGINE is being compiled into a self-contained |
909 | * shared-library. */ | 982 | * shared-library. */ |
910 | #ifdef ENGINE_DYNAMIC_SUPPORT | 983 | #ifdef ENGINE_DYNAMIC_SUPPORT |
diff --git a/src/lib/libcrypto/engine/hw_ncipher.c b/src/lib/libcrypto/engine/hw_ncipher.c index a43d4360f2..0d1c6b8df0 100644 --- a/src/lib/libcrypto/engine/hw_ncipher.c +++ b/src/lib/libcrypto/engine/hw_ncipher.c | |||
@@ -91,11 +91,19 @@ static int hwcrhk_init(ENGINE *e); | |||
91 | static int hwcrhk_finish(ENGINE *e); | 91 | static int hwcrhk_finish(ENGINE *e); |
92 | static int hwcrhk_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)()); | 92 | static int hwcrhk_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)()); |
93 | 93 | ||
94 | /* Functions to handle mutexes */ | 94 | /* Functions to handle mutexes if have dynamic locks */ |
95 | static int hwcrhk_mutex_init(HWCryptoHook_Mutex*, HWCryptoHook_CallerContext*); | 95 | static int hwcrhk_mutex_init(HWCryptoHook_Mutex*, HWCryptoHook_CallerContext*); |
96 | static int hwcrhk_mutex_lock(HWCryptoHook_Mutex*); | 96 | static int hwcrhk_mutex_lock(HWCryptoHook_Mutex*); |
97 | static void hwcrhk_mutex_unlock(HWCryptoHook_Mutex*); | 97 | static void hwcrhk_mutex_unlock(HWCryptoHook_Mutex*); |
98 | static void hwcrhk_mutex_destroy(HWCryptoHook_Mutex*); | 98 | static void hwcrhk_mutex_destroy(HWCryptoHook_Mutex*); |
99 | #if 1 /* This is a HACK which will disappear in 0.9.8 */ | ||
100 | /* Functions to handle mutexes if only have static locks */ | ||
101 | static int hwcrhk_static_mutex_init(HWCryptoHook_Mutex *m, | ||
102 | HWCryptoHook_CallerContext *c); | ||
103 | static int hwcrhk_static_mutex_lock(HWCryptoHook_Mutex *m); | ||
104 | static void hwcrhk_static_mutex_unlock(HWCryptoHook_Mutex *m); | ||
105 | static void hwcrhk_static_mutex_destroy(HWCryptoHook_Mutex *m); | ||
106 | #endif | ||
99 | 107 | ||
100 | /* BIGNUM stuff */ | 108 | /* BIGNUM stuff */ |
101 | static int hwcrhk_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, | 109 | static int hwcrhk_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, |
@@ -373,6 +381,7 @@ static int bind_helper(ENGINE *e) | |||
373 | return 1; | 381 | return 1; |
374 | } | 382 | } |
375 | 383 | ||
384 | #ifndef ENGINE_DYNAMIC_SUPPORT | ||
376 | static ENGINE *engine_ncipher(void) | 385 | static ENGINE *engine_ncipher(void) |
377 | { | 386 | { |
378 | ENGINE *ret = ENGINE_new(); | 387 | ENGINE *ret = ENGINE_new(); |
@@ -395,6 +404,7 @@ void ENGINE_load_chil(void) | |||
395 | ENGINE_free(toadd); | 404 | ENGINE_free(toadd); |
396 | ERR_clear_error(); | 405 | ERR_clear_error(); |
397 | } | 406 | } |
407 | #endif | ||
398 | 408 | ||
399 | /* This is a process-global DSO handle used for loading and unloading | 409 | /* This is a process-global DSO handle used for loading and unloading |
400 | * the HWCryptoHook library. NB: This is only set (or unset) during an | 410 | * the HWCryptoHook library. NB: This is only set (or unset) during an |
@@ -558,15 +568,31 @@ static int hwcrhk_init(ENGINE *e) | |||
558 | 568 | ||
559 | /* Check if the application decided to support dynamic locks, | 569 | /* Check if the application decided to support dynamic locks, |
560 | and if it does, use them. */ | 570 | and if it does, use them. */ |
561 | if (disable_mutex_callbacks == 0 && | 571 | if (disable_mutex_callbacks == 0) |
562 | CRYPTO_get_dynlock_create_callback() != NULL && | ||
563 | CRYPTO_get_dynlock_lock_callback() != NULL && | ||
564 | CRYPTO_get_dynlock_destroy_callback() != NULL) | ||
565 | { | 572 | { |
566 | hwcrhk_globals.mutex_init = hwcrhk_mutex_init; | 573 | if (CRYPTO_get_dynlock_create_callback() != NULL && |
567 | hwcrhk_globals.mutex_acquire = hwcrhk_mutex_lock; | 574 | CRYPTO_get_dynlock_lock_callback() != NULL && |
568 | hwcrhk_globals.mutex_release = hwcrhk_mutex_unlock; | 575 | CRYPTO_get_dynlock_destroy_callback() != NULL) |
569 | hwcrhk_globals.mutex_destroy = hwcrhk_mutex_destroy; | 576 | { |
577 | hwcrhk_globals.mutex_init = hwcrhk_mutex_init; | ||
578 | hwcrhk_globals.mutex_acquire = hwcrhk_mutex_lock; | ||
579 | hwcrhk_globals.mutex_release = hwcrhk_mutex_unlock; | ||
580 | hwcrhk_globals.mutex_destroy = hwcrhk_mutex_destroy; | ||
581 | } | ||
582 | else if (CRYPTO_get_locking_callback() != NULL) | ||
583 | { | ||
584 | HWCRHKerr(HWCRHK_F_HWCRHK_INIT,HWCRHK_R_DYNAMIC_LOCKING_MISSING); | ||
585 | ERR_add_error_data(1,"You HAVE to add dynamic locking callbacks via CRYPTO_set_dynlock_{create,lock,destroy}_callback()"); | ||
586 | #if 1 /* This is a HACK which will disappear in 0.9.8 */ | ||
587 | hwcrhk_globals.maxmutexes = 1; /* Only have one lock */ | ||
588 | hwcrhk_globals.mutex_init = hwcrhk_static_mutex_init; | ||
589 | hwcrhk_globals.mutex_acquire = hwcrhk_static_mutex_lock; | ||
590 | hwcrhk_globals.mutex_release = hwcrhk_static_mutex_unlock; | ||
591 | hwcrhk_globals.mutex_destroy = hwcrhk_static_mutex_destroy; | ||
592 | #else | ||
593 | goto err; | ||
594 | #endif | ||
595 | } | ||
570 | } | 596 | } |
571 | 597 | ||
572 | /* Try and get a context - if not, we may have a DSO but no | 598 | /* Try and get a context - if not, we may have a DSO but no |
@@ -1020,7 +1046,7 @@ static int hwcrhk_rsa_mod_exp(BIGNUM *r, const BIGNUM *I, RSA *rsa) | |||
1020 | 1046 | ||
1021 | /* Perform the operation */ | 1047 | /* Perform the operation */ |
1022 | ret = p_hwcrhk_ModExpCRT(hwcrhk_context, m_a, m_p, m_q, | 1048 | ret = p_hwcrhk_ModExpCRT(hwcrhk_context, m_a, m_p, m_q, |
1023 | m_dmp1, m_dmq1, m_iqmp, &m_r, NULL); | 1049 | m_dmp1, m_dmq1, m_iqmp, &m_r, &rmsg); |
1024 | 1050 | ||
1025 | /* Convert the response */ | 1051 | /* Convert the response */ |
1026 | r->top = m_r.size / sizeof(BN_ULONG); | 1052 | r->top = m_r.size / sizeof(BN_ULONG); |
@@ -1171,6 +1197,26 @@ static void hwcrhk_mutex_destroy(HWCryptoHook_Mutex *mt) | |||
1171 | CRYPTO_destroy_dynlockid(mt->lockid); | 1197 | CRYPTO_destroy_dynlockid(mt->lockid); |
1172 | } | 1198 | } |
1173 | 1199 | ||
1200 | /* Mutex upcalls to use if the application does not support dynamic locks */ | ||
1201 | |||
1202 | static int hwcrhk_static_mutex_init(HWCryptoHook_Mutex *m, | ||
1203 | HWCryptoHook_CallerContext *c) | ||
1204 | { | ||
1205 | return 0; | ||
1206 | } | ||
1207 | static int hwcrhk_static_mutex_lock(HWCryptoHook_Mutex *m) | ||
1208 | { | ||
1209 | CRYPTO_w_lock(CRYPTO_LOCK_HWCRHK); | ||
1210 | return 0; | ||
1211 | } | ||
1212 | static void hwcrhk_static_mutex_unlock(HWCryptoHook_Mutex *m) | ||
1213 | { | ||
1214 | CRYPTO_w_unlock(CRYPTO_LOCK_HWCRHK); | ||
1215 | } | ||
1216 | static void hwcrhk_static_mutex_destroy(HWCryptoHook_Mutex *m) | ||
1217 | { | ||
1218 | } | ||
1219 | |||
1174 | static int hwcrhk_get_pass(const char *prompt_info, | 1220 | static int hwcrhk_get_pass(const char *prompt_info, |
1175 | int *len_io, char *buf, | 1221 | int *len_io, char *buf, |
1176 | HWCryptoHook_PassphraseContext *ppctx, | 1222 | HWCryptoHook_PassphraseContext *ppctx, |
@@ -1318,7 +1364,7 @@ static void hwcrhk_log_message(void *logstr, const char *message) | |||
1318 | lstream=*(BIO **)logstr; | 1364 | lstream=*(BIO **)logstr; |
1319 | if (lstream) | 1365 | if (lstream) |
1320 | { | 1366 | { |
1321 | BIO_write(lstream, message, strlen(message)); | 1367 | BIO_printf(lstream, "%s\n", message); |
1322 | } | 1368 | } |
1323 | CRYPTO_w_unlock(CRYPTO_LOCK_BIO); | 1369 | CRYPTO_w_unlock(CRYPTO_LOCK_BIO); |
1324 | } | 1370 | } |
diff --git a/src/lib/libcrypto/engine/hw_ncipher_err.c b/src/lib/libcrypto/engine/hw_ncipher_err.c index 24024cfc6f..5bc94581b7 100644 --- a/src/lib/libcrypto/engine/hw_ncipher_err.c +++ b/src/lib/libcrypto/engine/hw_ncipher_err.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* hw_ncipher_err.c */ | 1 | /* hw_ncipher_err.c */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 1999 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2002 The OpenSSL Project. All rights reserved. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions | 6 | * modification, are permitted provided that the following conditions |
@@ -86,6 +86,7 @@ static ERR_STRING_DATA HWCRHK_str_reasons[]= | |||
86 | {HWCRHK_R_CHIL_ERROR ,"chil error"}, | 86 | {HWCRHK_R_CHIL_ERROR ,"chil error"}, |
87 | {HWCRHK_R_CTRL_COMMAND_NOT_IMPLEMENTED ,"ctrl command not implemented"}, | 87 | {HWCRHK_R_CTRL_COMMAND_NOT_IMPLEMENTED ,"ctrl command not implemented"}, |
88 | {HWCRHK_R_DSO_FAILURE ,"dso failure"}, | 88 | {HWCRHK_R_DSO_FAILURE ,"dso failure"}, |
89 | {HWCRHK_R_DYNAMIC_LOCKING_MISSING ,"dynamic locking missing"}, | ||
89 | {HWCRHK_R_MISSING_KEY_COMPONENTS ,"missing key components"}, | 90 | {HWCRHK_R_MISSING_KEY_COMPONENTS ,"missing key components"}, |
90 | {HWCRHK_R_NOT_INITIALISED ,"not initialised"}, | 91 | {HWCRHK_R_NOT_INITIALISED ,"not initialised"}, |
91 | {HWCRHK_R_NOT_LOADED ,"not loaded"}, | 92 | {HWCRHK_R_NOT_LOADED ,"not loaded"}, |
diff --git a/src/lib/libcrypto/engine/hw_ncipher_err.h b/src/lib/libcrypto/engine/hw_ncipher_err.h index 4d65b1d470..d232d02319 100644 --- a/src/lib/libcrypto/engine/hw_ncipher_err.h +++ b/src/lib/libcrypto/engine/hw_ncipher_err.h | |||
@@ -84,6 +84,7 @@ static void ERR_HWCRHK_error(int function, int reason, char *file, int line); | |||
84 | #define HWCRHK_R_CHIL_ERROR 102 | 84 | #define HWCRHK_R_CHIL_ERROR 102 |
85 | #define HWCRHK_R_CTRL_COMMAND_NOT_IMPLEMENTED 103 | 85 | #define HWCRHK_R_CTRL_COMMAND_NOT_IMPLEMENTED 103 |
86 | #define HWCRHK_R_DSO_FAILURE 104 | 86 | #define HWCRHK_R_DSO_FAILURE 104 |
87 | #define HWCRHK_R_DYNAMIC_LOCKING_MISSING 114 | ||
87 | #define HWCRHK_R_MISSING_KEY_COMPONENTS 105 | 88 | #define HWCRHK_R_MISSING_KEY_COMPONENTS 105 |
88 | #define HWCRHK_R_NOT_INITIALISED 106 | 89 | #define HWCRHK_R_NOT_INITIALISED 106 |
89 | #define HWCRHK_R_NOT_LOADED 107 | 90 | #define HWCRHK_R_NOT_LOADED 107 |
diff --git a/src/lib/libcrypto/engine/hw_nuron.c b/src/lib/libcrypto/engine/hw_nuron.c index 130b6d8b40..fb9188bfe5 100644 --- a/src/lib/libcrypto/engine/hw_nuron.c +++ b/src/lib/libcrypto/engine/hw_nuron.c | |||
@@ -374,6 +374,7 @@ static int bind_helper(ENGINE *e) | |||
374 | return 1; | 374 | return 1; |
375 | } | 375 | } |
376 | 376 | ||
377 | #ifndef ENGINE_DYNAMIC_SUPPORT | ||
377 | static ENGINE *engine_nuron(void) | 378 | static ENGINE *engine_nuron(void) |
378 | { | 379 | { |
379 | ENGINE *ret = ENGINE_new(); | 380 | ENGINE *ret = ENGINE_new(); |
@@ -396,6 +397,7 @@ void ENGINE_load_nuron(void) | |||
396 | ENGINE_free(toadd); | 397 | ENGINE_free(toadd); |
397 | ERR_clear_error(); | 398 | ERR_clear_error(); |
398 | } | 399 | } |
400 | #endif | ||
399 | 401 | ||
400 | /* This stuff is needed if this ENGINE is being compiled into a self-contained | 402 | /* This stuff is needed if this ENGINE is being compiled into a self-contained |
401 | * shared-library. */ | 403 | * shared-library. */ |
diff --git a/src/lib/libcrypto/engine/hw_sureware.c b/src/lib/libcrypto/engine/hw_sureware.c new file mode 100644 index 0000000000..fca467e690 --- /dev/null +++ b/src/lib/libcrypto/engine/hw_sureware.c | |||
@@ -0,0 +1,1039 @@ | |||
1 | /* Written by Corinne Dive-Reclus(cdive@baltimore.com) | ||
2 | * | ||
3 | * | ||
4 | * Redistribution and use in source and binary forms, with or without | ||
5 | * modification, are permitted provided that the following conditions | ||
6 | * are met: | ||
7 | * | ||
8 | * 1. Redistributions of source code must retain the above copyright | ||
9 | * notice, this list of conditions and the following disclaimer. | ||
10 | * | ||
11 | * 2. Redistributions in binary form must reproduce the above copyright | ||
12 | * notice, this list of conditions and the following disclaimer in | ||
13 | * the documentation and/or other materials provided with the | ||
14 | * distribution. | ||
15 | * | ||
16 | * 3. All advertising materials mentioning features or use of this | ||
17 | * software must display the following acknowledgment: | ||
18 | * "This product includes software developed by the OpenSSL Project | ||
19 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" | ||
20 | * | ||
21 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
22 | * endorse or promote products derived from this software without | ||
23 | * prior written permission. For written permission, please contact | ||
24 | * licensing@OpenSSL.org. | ||
25 | * | ||
26 | * 5. Products derived from this software may not be called "OpenSSL" | ||
27 | * nor may "OpenSSL" appear in their names without prior written | ||
28 | * permission of the OpenSSL Project. | ||
29 | * | ||
30 | * 6. Redistributions of any form whatsoever must retain the following | ||
31 | * acknowledgment: | ||
32 | * "This product includes software developed by the OpenSSL Project | ||
33 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" | ||
34 | * | ||
35 | * Written by Corinne Dive-Reclus(cdive@baltimore.com) | ||
36 | * | ||
37 | * Copyright@2001 Baltimore Technologies Ltd. | ||
38 | * All right Reserved. | ||
39 | * * | ||
40 | * THIS FILE IS PROVIDED BY BALTIMORE TECHNOLOGIES ``AS IS'' AND * | ||
41 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * | ||
42 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * | ||
43 | * ARE DISCLAIMED. IN NO EVENT SHALL BALTIMORE TECHNOLOGIES BE LIABLE * | ||
44 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * | ||
45 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * | ||
46 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * | ||
47 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * | ||
48 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * | ||
49 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * | ||
50 | * SUCH DAMAGE. * | ||
51 | ====================================================================*/ | ||
52 | |||
53 | #include <stdio.h> | ||
54 | #include "cryptlib.h" | ||
55 | #include <openssl/crypto.h> | ||
56 | #include <openssl/pem.h> | ||
57 | #include <openssl/dso.h> | ||
58 | #include "eng_int.h" | ||
59 | #include "engine.h" | ||
60 | #include <openssl/engine.h> | ||
61 | |||
62 | #ifndef OPENSSL_NO_HW | ||
63 | #ifndef OPENSSL_NO_HW_SUREWARE | ||
64 | |||
65 | #ifdef FLAT_INC | ||
66 | #include "sureware.h" | ||
67 | #else | ||
68 | #include "vendor_defns/sureware.h" | ||
69 | #endif | ||
70 | |||
71 | #define SUREWARE_LIB_NAME "sureware engine" | ||
72 | #include "hw_sureware_err.c" | ||
73 | |||
74 | static int surewarehk_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)()); | ||
75 | static int surewarehk_destroy(ENGINE *e); | ||
76 | static int surewarehk_init(ENGINE *e); | ||
77 | static int surewarehk_finish(ENGINE *e); | ||
78 | static int surewarehk_modexp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, | ||
79 | const BIGNUM *m, BN_CTX *ctx); | ||
80 | |||
81 | /* RSA stuff */ | ||
82 | static int surewarehk_rsa_priv_dec(int flen,const unsigned char *from,unsigned char *to, | ||
83 | RSA *rsa,int padding); | ||
84 | static int surewarehk_rsa_sign(int flen,const unsigned char *from,unsigned char *to, | ||
85 | RSA *rsa,int padding); | ||
86 | |||
87 | /* RAND stuff */ | ||
88 | static int surewarehk_rand_bytes(unsigned char *buf, int num); | ||
89 | static void surewarehk_rand_seed(const void *buf, int num); | ||
90 | static void surewarehk_rand_add(const void *buf, int num, double entropy); | ||
91 | |||
92 | /* KM stuff */ | ||
93 | static EVP_PKEY *surewarehk_load_privkey(ENGINE *e, const char *key_id, | ||
94 | UI_METHOD *ui_method, void *callback_data); | ||
95 | static EVP_PKEY *surewarehk_load_pubkey(ENGINE *e, const char *key_id, | ||
96 | UI_METHOD *ui_method, void *callback_data); | ||
97 | static void surewarehk_ex_free(void *obj, void *item, CRYPTO_EX_DATA *ad, | ||
98 | int idx,long argl, void *argp); | ||
99 | #if 0 | ||
100 | static void surewarehk_dh_ex_free(void *obj, void *item, CRYPTO_EX_DATA *ad, | ||
101 | int idx,long argl, void *argp); | ||
102 | #endif | ||
103 | |||
104 | #ifndef OPENSSL_NO_RSA | ||
105 | /* This function is aliased to mod_exp (with the mont stuff dropped). */ | ||
106 | static int surewarehk_mod_exp_mont(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, | ||
107 | const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx) | ||
108 | { | ||
109 | return surewarehk_modexp(r, a, p, m, ctx); | ||
110 | } | ||
111 | |||
112 | /* Our internal RSA_METHOD that we provide pointers to */ | ||
113 | static RSA_METHOD surewarehk_rsa = | ||
114 | { | ||
115 | "SureWare RSA method", | ||
116 | NULL, /* pub_enc*/ | ||
117 | NULL, /* pub_dec*/ | ||
118 | surewarehk_rsa_sign, /* our rsa_sign is OpenSSL priv_enc*/ | ||
119 | surewarehk_rsa_priv_dec, /* priv_dec*/ | ||
120 | NULL, /*mod_exp*/ | ||
121 | surewarehk_mod_exp_mont, /*mod_exp_mongomery*/ | ||
122 | NULL, /* init*/ | ||
123 | NULL, /* finish*/ | ||
124 | 0, /* RSA flag*/ | ||
125 | NULL, | ||
126 | NULL, /* OpenSSL sign*/ | ||
127 | NULL /* OpenSSL verify*/ | ||
128 | }; | ||
129 | #endif | ||
130 | |||
131 | #ifndef OPENSSL_NO_DH | ||
132 | /* Our internal DH_METHOD that we provide pointers to */ | ||
133 | /* This function is aliased to mod_exp (with the dh and mont dropped). */ | ||
134 | static int surewarehk_modexp_dh(const DH *dh, BIGNUM *r, const BIGNUM *a, | ||
135 | const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx) | ||
136 | { | ||
137 | return surewarehk_modexp(r, a, p, m, ctx); | ||
138 | } | ||
139 | |||
140 | static DH_METHOD surewarehk_dh = | ||
141 | { | ||
142 | "SureWare DH method", | ||
143 | NULL,/*gen_key*/ | ||
144 | NULL,/*agree,*/ | ||
145 | surewarehk_modexp_dh, /*dh mod exp*/ | ||
146 | NULL, /* init*/ | ||
147 | NULL, /* finish*/ | ||
148 | 0, /* flags*/ | ||
149 | NULL | ||
150 | }; | ||
151 | #endif | ||
152 | |||
153 | static RAND_METHOD surewarehk_rand = | ||
154 | { | ||
155 | /* "SureWare RAND method", */ | ||
156 | surewarehk_rand_seed, | ||
157 | surewarehk_rand_bytes, | ||
158 | NULL,/*cleanup*/ | ||
159 | surewarehk_rand_add, | ||
160 | surewarehk_rand_bytes, | ||
161 | NULL,/*rand_status*/ | ||
162 | }; | ||
163 | |||
164 | #ifndef OPENSSL_NO_DSA | ||
165 | /* DSA stuff */ | ||
166 | static DSA_SIG * surewarehk_dsa_do_sign(const unsigned char *dgst, int dlen, DSA *dsa); | ||
167 | static int surewarehk_dsa_mod_exp(DSA *dsa, BIGNUM *rr, BIGNUM *a1, | ||
168 | BIGNUM *p1, BIGNUM *a2, BIGNUM *p2, BIGNUM *m, | ||
169 | BN_CTX *ctx, BN_MONT_CTX *in_mont) | ||
170 | { | ||
171 | BIGNUM t; | ||
172 | int to_return = 0; | ||
173 | BN_init(&t); | ||
174 | /* let rr = a1 ^ p1 mod m */ | ||
175 | if (!surewarehk_modexp(rr,a1,p1,m,ctx)) goto end; | ||
176 | /* let t = a2 ^ p2 mod m */ | ||
177 | if (!surewarehk_modexp(&t,a2,p2,m,ctx)) goto end; | ||
178 | /* let rr = rr * t mod m */ | ||
179 | if (!BN_mod_mul(rr,rr,&t,m,ctx)) goto end; | ||
180 | to_return = 1; | ||
181 | end: | ||
182 | BN_free(&t); | ||
183 | return to_return; | ||
184 | } | ||
185 | |||
186 | static DSA_METHOD surewarehk_dsa = | ||
187 | { | ||
188 | "SureWare DSA method", | ||
189 | surewarehk_dsa_do_sign, | ||
190 | NULL,/*sign setup*/ | ||
191 | NULL,/*verify,*/ | ||
192 | surewarehk_dsa_mod_exp,/*mod exp*/ | ||
193 | NULL,/*bn mod exp*/ | ||
194 | NULL, /*init*/ | ||
195 | NULL,/*finish*/ | ||
196 | 0, | ||
197 | NULL, | ||
198 | }; | ||
199 | #endif | ||
200 | |||
201 | static const char *engine_sureware_id = "sureware"; | ||
202 | static const char *engine_sureware_name = "SureWare hardware engine support"; | ||
203 | |||
204 | /* Now, to our own code */ | ||
205 | |||
206 | /* As this is only ever called once, there's no need for locking | ||
207 | * (indeed - the lock will already be held by our caller!!!) */ | ||
208 | static int bind_sureware(ENGINE *e) | ||
209 | { | ||
210 | #ifndef OPENSSL_NO_RSA | ||
211 | const RSA_METHOD *meth1; | ||
212 | #endif | ||
213 | #ifndef OPENSSL_NO_DSA | ||
214 | const DSA_METHOD *meth2; | ||
215 | #endif | ||
216 | #ifndef OPENSSL_NO_DH | ||
217 | const DH_METHOD *meth3; | ||
218 | #endif | ||
219 | |||
220 | if(!ENGINE_set_id(e, engine_sureware_id) || | ||
221 | !ENGINE_set_name(e, engine_sureware_name) || | ||
222 | #ifndef OPENSSL_NO_RSA | ||
223 | !ENGINE_set_RSA(e, &surewarehk_rsa) || | ||
224 | #endif | ||
225 | #ifndef OPENSSL_NO_DSA | ||
226 | !ENGINE_set_DSA(e, &surewarehk_dsa) || | ||
227 | #endif | ||
228 | #ifndef OPENSSL_NO_DH | ||
229 | !ENGINE_set_DH(e, &surewarehk_dh) || | ||
230 | #endif | ||
231 | !ENGINE_set_RAND(e, &surewarehk_rand) || | ||
232 | !ENGINE_set_destroy_function(e, surewarehk_destroy) || | ||
233 | !ENGINE_set_init_function(e, surewarehk_init) || | ||
234 | !ENGINE_set_finish_function(e, surewarehk_finish) || | ||
235 | !ENGINE_set_ctrl_function(e, surewarehk_ctrl) || | ||
236 | !ENGINE_set_load_privkey_function(e, surewarehk_load_privkey) || | ||
237 | !ENGINE_set_load_pubkey_function(e, surewarehk_load_pubkey)) | ||
238 | return 0; | ||
239 | |||
240 | #ifndef OPENSSL_NO_RSA | ||
241 | /* We know that the "PKCS1_SSLeay()" functions hook properly | ||
242 | * to the cswift-specific mod_exp and mod_exp_crt so we use | ||
243 | * those functions. NB: We don't use ENGINE_openssl() or | ||
244 | * anything "more generic" because something like the RSAref | ||
245 | * code may not hook properly, and if you own one of these | ||
246 | * cards then you have the right to do RSA operations on it | ||
247 | * anyway! */ | ||
248 | meth1 = RSA_PKCS1_SSLeay(); | ||
249 | if (meth1) | ||
250 | { | ||
251 | surewarehk_rsa.rsa_pub_enc = meth1->rsa_pub_enc; | ||
252 | surewarehk_rsa.rsa_pub_dec = meth1->rsa_pub_dec; | ||
253 | } | ||
254 | #endif | ||
255 | |||
256 | #ifndef OPENSSL_NO_DSA | ||
257 | /* Use the DSA_OpenSSL() method and just hook the mod_exp-ish | ||
258 | * bits. */ | ||
259 | meth2 = DSA_OpenSSL(); | ||
260 | if (meth2) | ||
261 | { | ||
262 | surewarehk_dsa.dsa_do_verify = meth2->dsa_do_verify; | ||
263 | } | ||
264 | #endif | ||
265 | |||
266 | #ifndef OPENSSL_NO_DH | ||
267 | /* Much the same for Diffie-Hellman */ | ||
268 | meth3 = DH_OpenSSL(); | ||
269 | if (meth3) | ||
270 | { | ||
271 | surewarehk_dh.generate_key = meth3->generate_key; | ||
272 | surewarehk_dh.compute_key = meth3->compute_key; | ||
273 | } | ||
274 | #endif | ||
275 | |||
276 | /* Ensure the sureware error handling is set up */ | ||
277 | ERR_load_SUREWARE_strings(); | ||
278 | return 1; | ||
279 | } | ||
280 | |||
281 | #ifdef ENGINE_DYNAMIC_SUPPORT | ||
282 | static int bind_helper(ENGINE *e, const char *id) | ||
283 | { | ||
284 | if(id && (strcmp(id, engine_sureware_id) != 0)) | ||
285 | return 0; | ||
286 | if(!bind_sureware(e)) | ||
287 | return 0; | ||
288 | return 1; | ||
289 | } | ||
290 | IMPLEMENT_DYNAMIC_CHECK_FN() | ||
291 | IMPLEMENT_DYNAMIC_BIND_FN(bind_helper) | ||
292 | #else | ||
293 | static ENGINE *engine_sureware(void) | ||
294 | { | ||
295 | ENGINE *ret = ENGINE_new(); | ||
296 | if(!ret) | ||
297 | return NULL; | ||
298 | if(!bind_sureware(ret)) | ||
299 | { | ||
300 | ENGINE_free(ret); | ||
301 | return NULL; | ||
302 | } | ||
303 | return ret; | ||
304 | } | ||
305 | |||
306 | void ENGINE_load_sureware(void) | ||
307 | { | ||
308 | /* Copied from eng_[openssl|dyn].c */ | ||
309 | ENGINE *toadd = engine_sureware(); | ||
310 | if(!toadd) return; | ||
311 | ENGINE_add(toadd); | ||
312 | ENGINE_free(toadd); | ||
313 | ERR_clear_error(); | ||
314 | } | ||
315 | #endif | ||
316 | |||
317 | /* This is a process-global DSO handle used for loading and unloading | ||
318 | * the SureWareHook library. NB: This is only set (or unset) during an | ||
319 | * init() or finish() call (reference counts permitting) and they're | ||
320 | * operating with global locks, so this should be thread-safe | ||
321 | * implicitly. */ | ||
322 | static DSO *surewarehk_dso = NULL; | ||
323 | #ifndef OPENSSL_NO_RSA | ||
324 | static int rsaHndidx = -1; /* Index for KM handle. Not really used yet. */ | ||
325 | #endif | ||
326 | #ifndef OPENSSL_NO_DSA | ||
327 | static int dsaHndidx = -1; /* Index for KM handle. Not really used yet. */ | ||
328 | #endif | ||
329 | |||
330 | /* These are the function pointers that are (un)set when the library has | ||
331 | * successfully (un)loaded. */ | ||
332 | static SureWareHook_Init_t *p_surewarehk_Init = NULL; | ||
333 | static SureWareHook_Finish_t *p_surewarehk_Finish = NULL; | ||
334 | static SureWareHook_Rand_Bytes_t *p_surewarehk_Rand_Bytes = NULL; | ||
335 | static SureWareHook_Rand_Seed_t *p_surewarehk_Rand_Seed = NULL; | ||
336 | static SureWareHook_Load_Privkey_t *p_surewarehk_Load_Privkey = NULL; | ||
337 | static SureWareHook_Info_Pubkey_t *p_surewarehk_Info_Pubkey = NULL; | ||
338 | static SureWareHook_Load_Rsa_Pubkey_t *p_surewarehk_Load_Rsa_Pubkey = NULL; | ||
339 | static SureWareHook_Load_Dsa_Pubkey_t *p_surewarehk_Load_Dsa_Pubkey = NULL; | ||
340 | static SureWareHook_Free_t *p_surewarehk_Free=NULL; | ||
341 | static SureWareHook_Rsa_Priv_Dec_t *p_surewarehk_Rsa_Priv_Dec=NULL; | ||
342 | static SureWareHook_Rsa_Sign_t *p_surewarehk_Rsa_Sign=NULL; | ||
343 | static SureWareHook_Dsa_Sign_t *p_surewarehk_Dsa_Sign=NULL; | ||
344 | static SureWareHook_Mod_Exp_t *p_surewarehk_Mod_Exp=NULL; | ||
345 | |||
346 | /* Used in the DSO operations. */ | ||
347 | static const char *surewarehk_LIBNAME = "SureWareHook"; | ||
348 | static const char *n_surewarehk_Init = "SureWareHook_Init"; | ||
349 | static const char *n_surewarehk_Finish = "SureWareHook_Finish"; | ||
350 | static const char *n_surewarehk_Rand_Bytes="SureWareHook_Rand_Bytes"; | ||
351 | static const char *n_surewarehk_Rand_Seed="SureWareHook_Rand_Seed"; | ||
352 | static const char *n_surewarehk_Load_Privkey="SureWareHook_Load_Privkey"; | ||
353 | static const char *n_surewarehk_Info_Pubkey="SureWareHook_Info_Pubkey"; | ||
354 | static const char *n_surewarehk_Load_Rsa_Pubkey="SureWareHook_Load_Rsa_Pubkey"; | ||
355 | static const char *n_surewarehk_Load_Dsa_Pubkey="SureWareHook_Load_Dsa_Pubkey"; | ||
356 | static const char *n_surewarehk_Free="SureWareHook_Free"; | ||
357 | static const char *n_surewarehk_Rsa_Priv_Dec="SureWareHook_Rsa_Priv_Dec"; | ||
358 | static const char *n_surewarehk_Rsa_Sign="SureWareHook_Rsa_Sign"; | ||
359 | static const char *n_surewarehk_Dsa_Sign="SureWareHook_Dsa_Sign"; | ||
360 | static const char *n_surewarehk_Mod_Exp="SureWareHook_Mod_Exp"; | ||
361 | static BIO *logstream = NULL; | ||
362 | |||
363 | /* SureWareHook library functions and mechanics - these are used by the | ||
364 | * higher-level functions further down. NB: As and where there's no | ||
365 | * error checking, take a look lower down where these functions are | ||
366 | * called, the checking and error handling is probably down there. | ||
367 | */ | ||
368 | static int threadsafe=1; | ||
369 | static int surewarehk_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)()) | ||
370 | { | ||
371 | int to_return = 1; | ||
372 | |||
373 | switch(cmd) | ||
374 | { | ||
375 | case ENGINE_CTRL_SET_LOGSTREAM: | ||
376 | { | ||
377 | BIO *bio = (BIO *)p; | ||
378 | CRYPTO_w_lock(CRYPTO_LOCK_ENGINE); | ||
379 | if (logstream) | ||
380 | { | ||
381 | BIO_free(logstream); | ||
382 | logstream = NULL; | ||
383 | } | ||
384 | if (CRYPTO_add(&bio->references,1,CRYPTO_LOCK_BIO) > 1) | ||
385 | logstream = bio; | ||
386 | else | ||
387 | SUREWAREerr(SUREWARE_F_SUREWAREHK_CTRL,SUREWARE_R_BIO_WAS_FREED); | ||
388 | } | ||
389 | CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE); | ||
390 | break; | ||
391 | /* This will prevent the initialisation function from "installing" | ||
392 | * the mutex-handling callbacks, even if they are available from | ||
393 | * within the library (or were provided to the library from the | ||
394 | * calling application). This is to remove any baggage for | ||
395 | * applications not using multithreading. */ | ||
396 | case ENGINE_CTRL_CHIL_NO_LOCKING: | ||
397 | CRYPTO_w_lock(CRYPTO_LOCK_ENGINE); | ||
398 | threadsafe = 0; | ||
399 | CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE); | ||
400 | break; | ||
401 | |||
402 | /* The command isn't understood by this engine */ | ||
403 | default: | ||
404 | SUREWAREerr(SUREWARE_F_SUREWAREHK_CTRL, | ||
405 | ENGINE_R_CTRL_COMMAND_NOT_IMPLEMENTED); | ||
406 | to_return = 0; | ||
407 | break; | ||
408 | } | ||
409 | |||
410 | return to_return; | ||
411 | } | ||
412 | |||
413 | /* Destructor (complements the "ENGINE_surewarehk()" constructor) */ | ||
414 | static int surewarehk_destroy(ENGINE *e) | ||
415 | { | ||
416 | ERR_unload_SUREWARE_strings(); | ||
417 | return 1; | ||
418 | } | ||
419 | |||
420 | /* (de)initialisation functions. */ | ||
421 | static int surewarehk_init(ENGINE *e) | ||
422 | { | ||
423 | char msg[64]="ENGINE_init"; | ||
424 | SureWareHook_Init_t *p1=NULL; | ||
425 | SureWareHook_Finish_t *p2=NULL; | ||
426 | SureWareHook_Rand_Bytes_t *p3=NULL; | ||
427 | SureWareHook_Rand_Seed_t *p4=NULL; | ||
428 | SureWareHook_Load_Privkey_t *p5=NULL; | ||
429 | SureWareHook_Load_Rsa_Pubkey_t *p6=NULL; | ||
430 | SureWareHook_Free_t *p7=NULL; | ||
431 | SureWareHook_Rsa_Priv_Dec_t *p8=NULL; | ||
432 | SureWareHook_Rsa_Sign_t *p9=NULL; | ||
433 | SureWareHook_Dsa_Sign_t *p12=NULL; | ||
434 | SureWareHook_Info_Pubkey_t *p13=NULL; | ||
435 | SureWareHook_Load_Dsa_Pubkey_t *p14=NULL; | ||
436 | SureWareHook_Mod_Exp_t *p15=NULL; | ||
437 | |||
438 | if(surewarehk_dso != NULL) | ||
439 | { | ||
440 | SUREWAREerr(SUREWARE_F_SUREWAREHK_INIT,ENGINE_R_ALREADY_LOADED); | ||
441 | goto err; | ||
442 | } | ||
443 | /* Attempt to load libsurewarehk.so/surewarehk.dll/whatever. */ | ||
444 | surewarehk_dso = DSO_load(NULL, surewarehk_LIBNAME, NULL, 0); | ||
445 | if(surewarehk_dso == NULL) | ||
446 | { | ||
447 | SUREWAREerr(SUREWARE_F_SUREWAREHK_INIT,ENGINE_R_DSO_FAILURE); | ||
448 | goto err; | ||
449 | } | ||
450 | if(!(p1=(SureWareHook_Init_t*)DSO_bind_func(surewarehk_dso, n_surewarehk_Init)) || | ||
451 | !(p2=(SureWareHook_Finish_t*)DSO_bind_func(surewarehk_dso, n_surewarehk_Finish)) || | ||
452 | !(p3=(SureWareHook_Rand_Bytes_t*)DSO_bind_func(surewarehk_dso, n_surewarehk_Rand_Bytes)) || | ||
453 | !(p4=(SureWareHook_Rand_Seed_t*)DSO_bind_func(surewarehk_dso, n_surewarehk_Rand_Seed)) || | ||
454 | !(p5=(SureWareHook_Load_Privkey_t*)DSO_bind_func(surewarehk_dso, n_surewarehk_Load_Privkey)) || | ||
455 | !(p6=(SureWareHook_Load_Rsa_Pubkey_t*)DSO_bind_func(surewarehk_dso, n_surewarehk_Load_Rsa_Pubkey)) || | ||
456 | !(p7=(SureWareHook_Free_t*)DSO_bind_func(surewarehk_dso, n_surewarehk_Free)) || | ||
457 | !(p8=(SureWareHook_Rsa_Priv_Dec_t*)DSO_bind_func(surewarehk_dso, n_surewarehk_Rsa_Priv_Dec)) || | ||
458 | !(p9=(SureWareHook_Rsa_Sign_t*)DSO_bind_func(surewarehk_dso, n_surewarehk_Rsa_Sign)) || | ||
459 | !(p12=(SureWareHook_Dsa_Sign_t*)DSO_bind_func(surewarehk_dso, n_surewarehk_Dsa_Sign)) || | ||
460 | !(p13=(SureWareHook_Info_Pubkey_t*)DSO_bind_func(surewarehk_dso, n_surewarehk_Info_Pubkey)) || | ||
461 | !(p14=(SureWareHook_Load_Dsa_Pubkey_t*)DSO_bind_func(surewarehk_dso, n_surewarehk_Load_Dsa_Pubkey)) || | ||
462 | !(p15=(SureWareHook_Mod_Exp_t*)DSO_bind_func(surewarehk_dso, n_surewarehk_Mod_Exp))) | ||
463 | { | ||
464 | SUREWAREerr(SUREWARE_F_SUREWAREHK_INIT,ENGINE_R_DSO_FAILURE); | ||
465 | goto err; | ||
466 | } | ||
467 | /* Copy the pointers */ | ||
468 | p_surewarehk_Init = p1; | ||
469 | p_surewarehk_Finish = p2; | ||
470 | p_surewarehk_Rand_Bytes = p3; | ||
471 | p_surewarehk_Rand_Seed = p4; | ||
472 | p_surewarehk_Load_Privkey = p5; | ||
473 | p_surewarehk_Load_Rsa_Pubkey = p6; | ||
474 | p_surewarehk_Free = p7; | ||
475 | p_surewarehk_Rsa_Priv_Dec = p8; | ||
476 | p_surewarehk_Rsa_Sign = p9; | ||
477 | p_surewarehk_Dsa_Sign = p12; | ||
478 | p_surewarehk_Info_Pubkey = p13; | ||
479 | p_surewarehk_Load_Dsa_Pubkey = p14; | ||
480 | p_surewarehk_Mod_Exp = p15; | ||
481 | /* Contact the hardware and initialises it. */ | ||
482 | if(p_surewarehk_Init(msg,threadsafe)==SUREWAREHOOK_ERROR_UNIT_FAILURE) | ||
483 | { | ||
484 | SUREWAREerr(SUREWARE_F_SUREWAREHK_INIT,SUREWARE_R_UNIT_FAILURE); | ||
485 | goto err; | ||
486 | } | ||
487 | if(p_surewarehk_Init(msg,threadsafe)==SUREWAREHOOK_ERROR_UNIT_FAILURE) | ||
488 | { | ||
489 | SUREWAREerr(SUREWARE_F_SUREWAREHK_INIT,SUREWARE_R_UNIT_FAILURE); | ||
490 | goto err; | ||
491 | } | ||
492 | /* try to load the default private key, if failed does not return a failure but | ||
493 | wait for an explicit ENGINE_load_privakey */ | ||
494 | surewarehk_load_privkey(e,NULL,NULL,NULL); | ||
495 | |||
496 | /* Everything's fine. */ | ||
497 | #ifndef OPENSSL_NO_RSA | ||
498 | if (rsaHndidx == -1) | ||
499 | rsaHndidx = RSA_get_ex_new_index(0, | ||
500 | "SureWareHook RSA key handle", | ||
501 | NULL, NULL, surewarehk_ex_free); | ||
502 | #endif | ||
503 | #ifndef OPENSSL_NO_DSA | ||
504 | if (dsaHndidx == -1) | ||
505 | dsaHndidx = DSA_get_ex_new_index(0, | ||
506 | "SureWareHook DSA key handle", | ||
507 | NULL, NULL, surewarehk_ex_free); | ||
508 | #endif | ||
509 | |||
510 | return 1; | ||
511 | err: | ||
512 | if(surewarehk_dso) | ||
513 | DSO_free(surewarehk_dso); | ||
514 | surewarehk_dso = NULL; | ||
515 | p_surewarehk_Init = NULL; | ||
516 | p_surewarehk_Finish = NULL; | ||
517 | p_surewarehk_Rand_Bytes = NULL; | ||
518 | p_surewarehk_Rand_Seed = NULL; | ||
519 | p_surewarehk_Load_Privkey = NULL; | ||
520 | p_surewarehk_Load_Rsa_Pubkey = NULL; | ||
521 | p_surewarehk_Free = NULL; | ||
522 | p_surewarehk_Rsa_Priv_Dec = NULL; | ||
523 | p_surewarehk_Rsa_Sign = NULL; | ||
524 | p_surewarehk_Dsa_Sign = NULL; | ||
525 | p_surewarehk_Info_Pubkey = NULL; | ||
526 | p_surewarehk_Load_Dsa_Pubkey = NULL; | ||
527 | p_surewarehk_Mod_Exp = NULL; | ||
528 | return 0; | ||
529 | } | ||
530 | |||
531 | static int surewarehk_finish(ENGINE *e) | ||
532 | { | ||
533 | int to_return = 1; | ||
534 | if(surewarehk_dso == NULL) | ||
535 | { | ||
536 | SUREWAREerr(SUREWARE_F_SUREWAREHK_FINISH,ENGINE_R_NOT_LOADED); | ||
537 | to_return = 0; | ||
538 | goto err; | ||
539 | } | ||
540 | p_surewarehk_Finish(); | ||
541 | if(!DSO_free(surewarehk_dso)) | ||
542 | { | ||
543 | SUREWAREerr(SUREWARE_F_SUREWAREHK_FINISH,ENGINE_R_DSO_FAILURE); | ||
544 | to_return = 0; | ||
545 | goto err; | ||
546 | } | ||
547 | err: | ||
548 | if (logstream) | ||
549 | BIO_free(logstream); | ||
550 | surewarehk_dso = NULL; | ||
551 | p_surewarehk_Init = NULL; | ||
552 | p_surewarehk_Finish = NULL; | ||
553 | p_surewarehk_Rand_Bytes = NULL; | ||
554 | p_surewarehk_Rand_Seed = NULL; | ||
555 | p_surewarehk_Load_Privkey = NULL; | ||
556 | p_surewarehk_Load_Rsa_Pubkey = NULL; | ||
557 | p_surewarehk_Free = NULL; | ||
558 | p_surewarehk_Rsa_Priv_Dec = NULL; | ||
559 | p_surewarehk_Rsa_Sign = NULL; | ||
560 | p_surewarehk_Dsa_Sign = NULL; | ||
561 | p_surewarehk_Info_Pubkey = NULL; | ||
562 | p_surewarehk_Load_Dsa_Pubkey = NULL; | ||
563 | p_surewarehk_Mod_Exp = NULL; | ||
564 | return to_return; | ||
565 | } | ||
566 | |||
567 | static void surewarehk_error_handling(char *const msg,int func,int ret) | ||
568 | { | ||
569 | switch (ret) | ||
570 | { | ||
571 | case SUREWAREHOOK_ERROR_UNIT_FAILURE: | ||
572 | ENGINEerr(func,SUREWARE_R_UNIT_FAILURE); | ||
573 | break; | ||
574 | case SUREWAREHOOK_ERROR_FALLBACK: | ||
575 | ENGINEerr(func,SUREWARE_R_REQUEST_FALLBACK); | ||
576 | break; | ||
577 | case SUREWAREHOOK_ERROR_DATA_SIZE: | ||
578 | ENGINEerr(func,SUREWARE_R_SIZE_TOO_LARGE_OR_TOO_SMALL); | ||
579 | break; | ||
580 | case SUREWAREHOOK_ERROR_INVALID_PAD: | ||
581 | ENGINEerr(func,RSA_R_PADDING_CHECK_FAILED); | ||
582 | break; | ||
583 | default: | ||
584 | ENGINEerr(func,SUREWARE_R_REQUEST_FAILED); | ||
585 | break; | ||
586 | case 1:/*nothing*/ | ||
587 | msg[0]='\0'; | ||
588 | } | ||
589 | if (*msg) | ||
590 | { | ||
591 | ERR_add_error_data(1,msg); | ||
592 | if (logstream) | ||
593 | { | ||
594 | CRYPTO_w_lock(CRYPTO_LOCK_BIO); | ||
595 | BIO_write(logstream, msg, strlen(msg)); | ||
596 | CRYPTO_w_unlock(CRYPTO_LOCK_BIO); | ||
597 | } | ||
598 | } | ||
599 | } | ||
600 | |||
601 | static int surewarehk_rand_bytes(unsigned char *buf, int num) | ||
602 | { | ||
603 | int ret=0; | ||
604 | char msg[64]="ENGINE_rand_bytes"; | ||
605 | if(!p_surewarehk_Rand_Bytes) | ||
606 | { | ||
607 | SUREWAREerr(SUREWARE_F_SUREWAREHK_RAND_BYTES,ENGINE_R_NOT_INITIALISED); | ||
608 | } | ||
609 | else | ||
610 | { | ||
611 | ret = p_surewarehk_Rand_Bytes(msg,buf, num); | ||
612 | surewarehk_error_handling(msg,SUREWARE_F_SUREWAREHK_RAND_BYTES,ret); | ||
613 | } | ||
614 | return ret==1 ? 1 : 0; | ||
615 | } | ||
616 | |||
617 | static void surewarehk_rand_seed(const void *buf, int num) | ||
618 | { | ||
619 | int ret=0; | ||
620 | char msg[64]="ENGINE_rand_seed"; | ||
621 | if(!p_surewarehk_Rand_Seed) | ||
622 | { | ||
623 | SUREWAREerr(SUREWARE_F_SUREWAREHK_RAND_SEED,ENGINE_R_NOT_INITIALISED); | ||
624 | } | ||
625 | else | ||
626 | { | ||
627 | ret = p_surewarehk_Rand_Seed(msg,buf, num); | ||
628 | surewarehk_error_handling(msg,SUREWARE_F_SUREWAREHK_RAND_SEED,ret); | ||
629 | } | ||
630 | } | ||
631 | |||
632 | static void surewarehk_rand_add(const void *buf, int num, double entropy) | ||
633 | { | ||
634 | surewarehk_rand_seed(buf,num); | ||
635 | } | ||
636 | |||
637 | static EVP_PKEY* sureware_load_public(ENGINE *e,const char *key_id,char *hptr,unsigned long el,char keytype) | ||
638 | { | ||
639 | EVP_PKEY *res = NULL; | ||
640 | #ifndef OPENSSL_NO_RSA | ||
641 | RSA *rsatmp = NULL; | ||
642 | #endif | ||
643 | #ifndef OPENSSL_NO_DSA | ||
644 | DSA *dsatmp=NULL; | ||
645 | #endif | ||
646 | char msg[64]="sureware_load_public"; | ||
647 | int ret=0; | ||
648 | if(!p_surewarehk_Load_Rsa_Pubkey || !p_surewarehk_Load_Dsa_Pubkey) | ||
649 | { | ||
650 | SUREWAREerr(SUREWARE_F_SUREWAREHK_LOAD_PUBLIC_KEY,ENGINE_R_NOT_INITIALISED); | ||
651 | goto err; | ||
652 | } | ||
653 | switch (keytype) | ||
654 | { | ||
655 | #ifndef OPENSSL_NO_RSA | ||
656 | case 1: /*RSA*/ | ||
657 | /* set private external reference */ | ||
658 | rsatmp = RSA_new_method(e); | ||
659 | RSA_set_ex_data(rsatmp,rsaHndidx,hptr); | ||
660 | rsatmp->flags |= RSA_FLAG_EXT_PKEY; | ||
661 | |||
662 | /* set public big nums*/ | ||
663 | rsatmp->e = BN_new(); | ||
664 | rsatmp->n = BN_new(); | ||
665 | bn_expand2(rsatmp->e, el/sizeof(BN_ULONG)); | ||
666 | bn_expand2(rsatmp->n, el/sizeof(BN_ULONG)); | ||
667 | if (!rsatmp->e || rsatmp->e->dmax!=(int)(el/sizeof(BN_ULONG))|| | ||
668 | !rsatmp->n || rsatmp->n->dmax!=(int)(el/sizeof(BN_ULONG))) | ||
669 | goto err; | ||
670 | ret=p_surewarehk_Load_Rsa_Pubkey(msg,key_id,el, | ||
671 | (unsigned long *)rsatmp->n->d, | ||
672 | (unsigned long *)rsatmp->e->d); | ||
673 | surewarehk_error_handling(msg,SUREWARE_F_SUREWAREHK_LOAD_PUBLIC_KEY,ret); | ||
674 | if (ret!=1) | ||
675 | { | ||
676 | SUREWAREerr(SUREWARE_F_SUREWAREHK_LOAD_PRIVATE_KEY,ENGINE_R_FAILED_LOADING_PUBLIC_KEY); | ||
677 | goto err; | ||
678 | } | ||
679 | /* normalise pub e and pub n */ | ||
680 | rsatmp->e->top=el/sizeof(BN_ULONG); | ||
681 | bn_fix_top(rsatmp->e); | ||
682 | rsatmp->n->top=el/sizeof(BN_ULONG); | ||
683 | bn_fix_top(rsatmp->n); | ||
684 | /* create an EVP object: engine + rsa key */ | ||
685 | res = EVP_PKEY_new(); | ||
686 | EVP_PKEY_assign_RSA(res, rsatmp); | ||
687 | break; | ||
688 | #endif | ||
689 | |||
690 | #ifndef OPENSSL_NO_DSA | ||
691 | case 2:/*DSA*/ | ||
692 | /* set private/public external reference */ | ||
693 | dsatmp = DSA_new_method(e); | ||
694 | DSA_set_ex_data(dsatmp,dsaHndidx,hptr); | ||
695 | /*dsatmp->flags |= DSA_FLAG_EXT_PKEY;*/ | ||
696 | |||
697 | /* set public key*/ | ||
698 | dsatmp->pub_key = BN_new(); | ||
699 | dsatmp->p = BN_new(); | ||
700 | dsatmp->q = BN_new(); | ||
701 | dsatmp->g = BN_new(); | ||
702 | bn_expand2(dsatmp->pub_key, el/sizeof(BN_ULONG)); | ||
703 | bn_expand2(dsatmp->p, el/sizeof(BN_ULONG)); | ||
704 | bn_expand2(dsatmp->q, 20/sizeof(BN_ULONG)); | ||
705 | bn_expand2(dsatmp->g, el/sizeof(BN_ULONG)); | ||
706 | if (!dsatmp->pub_key || dsatmp->pub_key->dmax!=(int)(el/sizeof(BN_ULONG))|| | ||
707 | !dsatmp->p || dsatmp->p->dmax!=(int)(el/sizeof(BN_ULONG)) || | ||
708 | !dsatmp->q || dsatmp->q->dmax!=20/sizeof(BN_ULONG) || | ||
709 | !dsatmp->g || dsatmp->g->dmax!=(int)(el/sizeof(BN_ULONG))) | ||
710 | goto err; | ||
711 | |||
712 | ret=p_surewarehk_Load_Dsa_Pubkey(msg,key_id,el, | ||
713 | (unsigned long *)dsatmp->pub_key->d, | ||
714 | (unsigned long *)dsatmp->p->d, | ||
715 | (unsigned long *)dsatmp->q->d, | ||
716 | (unsigned long *)dsatmp->g->d); | ||
717 | surewarehk_error_handling(msg,SUREWARE_F_SUREWAREHK_LOAD_PUBLIC_KEY,ret); | ||
718 | if (ret!=1) | ||
719 | { | ||
720 | SUREWAREerr(SUREWARE_F_SUREWAREHK_LOAD_PRIVATE_KEY,ENGINE_R_FAILED_LOADING_PUBLIC_KEY); | ||
721 | goto err; | ||
722 | } | ||
723 | /* set parameters */ | ||
724 | /* normalise pubkey and parameters in case of */ | ||
725 | dsatmp->pub_key->top=el/sizeof(BN_ULONG); | ||
726 | bn_fix_top(dsatmp->pub_key); | ||
727 | dsatmp->p->top=el/sizeof(BN_ULONG); | ||
728 | bn_fix_top(dsatmp->p); | ||
729 | dsatmp->q->top=20/sizeof(BN_ULONG); | ||
730 | bn_fix_top(dsatmp->q); | ||
731 | dsatmp->g->top=el/sizeof(BN_ULONG); | ||
732 | bn_fix_top(dsatmp->g); | ||
733 | |||
734 | /* create an EVP object: engine + rsa key */ | ||
735 | res = EVP_PKEY_new(); | ||
736 | EVP_PKEY_assign_DSA(res, dsatmp); | ||
737 | break; | ||
738 | #endif | ||
739 | |||
740 | default: | ||
741 | SUREWAREerr(SUREWARE_F_SUREWAREHK_LOAD_PRIVATE_KEY,ENGINE_R_FAILED_LOADING_PRIVATE_KEY); | ||
742 | goto err; | ||
743 | } | ||
744 | return res; | ||
745 | err: | ||
746 | if (res) | ||
747 | EVP_PKEY_free(res); | ||
748 | #ifndef OPENSSL_NO_RSA | ||
749 | if (rsatmp) | ||
750 | RSA_free(rsatmp); | ||
751 | #endif | ||
752 | #ifndef OPENSSL_NO_DSA | ||
753 | if (dsatmp) | ||
754 | DSA_free(dsatmp); | ||
755 | #endif | ||
756 | return NULL; | ||
757 | } | ||
758 | |||
759 | static EVP_PKEY *surewarehk_load_privkey(ENGINE *e, const char *key_id, | ||
760 | UI_METHOD *ui_method, void *callback_data) | ||
761 | { | ||
762 | EVP_PKEY *res = NULL; | ||
763 | int ret=0; | ||
764 | unsigned long el=0; | ||
765 | char *hptr=NULL; | ||
766 | char keytype=0; | ||
767 | char msg[64]="ENGINE_load_privkey"; | ||
768 | |||
769 | if(!p_surewarehk_Load_Privkey) | ||
770 | { | ||
771 | SUREWAREerr(SUREWARE_F_SUREWAREHK_LOAD_PRIVATE_KEY,ENGINE_R_NOT_INITIALISED); | ||
772 | } | ||
773 | else | ||
774 | { | ||
775 | ret=p_surewarehk_Load_Privkey(msg,key_id,&hptr,&el,&keytype); | ||
776 | if (ret!=1) | ||
777 | { | ||
778 | SUREWAREerr(SUREWARE_F_SUREWAREHK_LOAD_PRIVATE_KEY,ENGINE_R_FAILED_LOADING_PRIVATE_KEY); | ||
779 | ERR_add_error_data(1,msg); | ||
780 | } | ||
781 | else | ||
782 | res=sureware_load_public(e,key_id,hptr,el,keytype); | ||
783 | } | ||
784 | return res; | ||
785 | } | ||
786 | |||
787 | static EVP_PKEY *surewarehk_load_pubkey(ENGINE *e, const char *key_id, | ||
788 | UI_METHOD *ui_method, void *callback_data) | ||
789 | { | ||
790 | EVP_PKEY *res = NULL; | ||
791 | int ret=0; | ||
792 | unsigned long el=0; | ||
793 | char *hptr=NULL; | ||
794 | char keytype=0; | ||
795 | char msg[64]="ENGINE_load_pubkey"; | ||
796 | |||
797 | if(!p_surewarehk_Info_Pubkey) | ||
798 | { | ||
799 | SUREWAREerr(SUREWARE_F_SUREWAREHK_LOAD_PUBLIC_KEY,ENGINE_R_NOT_INITIALISED); | ||
800 | } | ||
801 | else | ||
802 | { | ||
803 | /* call once to identify if DSA or RSA */ | ||
804 | ret=p_surewarehk_Info_Pubkey(msg,key_id,&el,&keytype); | ||
805 | if (ret!=1) | ||
806 | { | ||
807 | SUREWAREerr(SUREWARE_F_SUREWAREHK_LOAD_PUBLIC_KEY,ENGINE_R_FAILED_LOADING_PUBLIC_KEY); | ||
808 | ERR_add_error_data(1,msg); | ||
809 | } | ||
810 | else | ||
811 | res=sureware_load_public(e,key_id,hptr,el,keytype); | ||
812 | } | ||
813 | return res; | ||
814 | } | ||
815 | |||
816 | /* This cleans up an RSA/DSA KM key(do not destroy the key into the hardware) | ||
817 | , called when ex_data is freed */ | ||
818 | static void surewarehk_ex_free(void *obj, void *item, CRYPTO_EX_DATA *ad, | ||
819 | int idx,long argl, void *argp) | ||
820 | { | ||
821 | if(!p_surewarehk_Free) | ||
822 | { | ||
823 | SUREWAREerr(SUREWARE_F_SUREWAREHK_EX_FREE,ENGINE_R_NOT_INITIALISED); | ||
824 | } | ||
825 | else | ||
826 | p_surewarehk_Free((char *)item,0); | ||
827 | } | ||
828 | |||
829 | #if 0 | ||
830 | /* This cleans up an DH KM key (destroys the key into hardware), | ||
831 | called when ex_data is freed */ | ||
832 | static void surewarehk_dh_ex_free(void *obj, void *item, CRYPTO_EX_DATA *ad, | ||
833 | int idx,long argl, void *argp) | ||
834 | { | ||
835 | if(!p_surewarehk_Free) | ||
836 | { | ||
837 | SUREWAREerr(SUREWARE_F_SUREWAREHK_EX_FREE,ENGINE_R_NOT_INITIALISED); | ||
838 | } | ||
839 | else | ||
840 | p_surewarehk_Free((char *)item,1); | ||
841 | } | ||
842 | #endif | ||
843 | |||
844 | /* | ||
845 | * return number of decrypted bytes | ||
846 | */ | ||
847 | #ifndef OPENSSL_NO_RSA | ||
848 | static int surewarehk_rsa_priv_dec(int flen,const unsigned char *from,unsigned char *to, | ||
849 | RSA *rsa,int padding) | ||
850 | { | ||
851 | int ret=0,tlen; | ||
852 | char *buf=NULL,*hptr=NULL; | ||
853 | char msg[64]="ENGINE_rsa_priv_dec"; | ||
854 | if (!p_surewarehk_Rsa_Priv_Dec) | ||
855 | { | ||
856 | SUREWAREerr(SUREWARE_F_SUREWAREHK_RSA_PRIV_DEC,ENGINE_R_NOT_INITIALISED); | ||
857 | } | ||
858 | /* extract ref to private key */ | ||
859 | else if (!(hptr=RSA_get_ex_data(rsa, rsaHndidx))) | ||
860 | { | ||
861 | SUREWAREerr(SUREWARE_F_SUREWAREHK_RSA_PRIV_DEC,SUREWARE_R_MISSING_KEY_COMPONENTS); | ||
862 | goto err; | ||
863 | } | ||
864 | /* analyse what padding we can do into the hardware */ | ||
865 | if (padding==RSA_PKCS1_PADDING) | ||
866 | { | ||
867 | /* do it one shot */ | ||
868 | ret=p_surewarehk_Rsa_Priv_Dec(msg,flen,(unsigned char *)from,&tlen,to,hptr,SUREWARE_PKCS1_PAD); | ||
869 | surewarehk_error_handling(msg,SUREWARE_F_SUREWAREHK_RSA_PRIV_DEC,ret); | ||
870 | if (ret!=1) | ||
871 | goto err; | ||
872 | ret=tlen; | ||
873 | } | ||
874 | else /* do with no padding into hardware */ | ||
875 | { | ||
876 | ret=p_surewarehk_Rsa_Priv_Dec(msg,flen,(unsigned char *)from,&tlen,to,hptr,SUREWARE_NO_PAD); | ||
877 | surewarehk_error_handling(msg,SUREWARE_F_SUREWAREHK_RSA_PRIV_DEC,ret); | ||
878 | if (ret!=1) | ||
879 | goto err; | ||
880 | /* intermediate buffer for padding */ | ||
881 | if ((buf=OPENSSL_malloc(tlen)) == NULL) | ||
882 | { | ||
883 | RSAerr(SUREWARE_F_SUREWAREHK_RSA_PRIV_DEC,ERR_R_MALLOC_FAILURE); | ||
884 | goto err; | ||
885 | } | ||
886 | memcpy(buf,to,tlen);/* transfert to into buf */ | ||
887 | switch (padding) /* check padding in software */ | ||
888 | { | ||
889 | #ifndef OPENSSL_NO_SHA | ||
890 | case RSA_PKCS1_OAEP_PADDING: | ||
891 | ret=RSA_padding_check_PKCS1_OAEP(to,tlen,(unsigned char *)buf,tlen,tlen,NULL,0); | ||
892 | break; | ||
893 | #endif | ||
894 | case RSA_SSLV23_PADDING: | ||
895 | ret=RSA_padding_check_SSLv23(to,tlen,(unsigned char *)buf,flen,tlen); | ||
896 | break; | ||
897 | case RSA_NO_PADDING: | ||
898 | ret=RSA_padding_check_none(to,tlen,(unsigned char *)buf,flen,tlen); | ||
899 | break; | ||
900 | default: | ||
901 | RSAerr(SUREWARE_F_SUREWAREHK_RSA_PRIV_DEC,RSA_R_UNKNOWN_PADDING_TYPE); | ||
902 | goto err; | ||
903 | } | ||
904 | if (ret < 0) | ||
905 | RSAerr(SUREWARE_F_SUREWAREHK_RSA_PRIV_DEC,RSA_R_PADDING_CHECK_FAILED); | ||
906 | } | ||
907 | err: | ||
908 | if (buf) | ||
909 | { | ||
910 | OPENSSL_cleanse(buf,tlen); | ||
911 | OPENSSL_free(buf); | ||
912 | } | ||
913 | return ret; | ||
914 | } | ||
915 | |||
916 | /* | ||
917 | * Does what OpenSSL rsa_priv_enc does. | ||
918 | */ | ||
919 | static int surewarehk_rsa_sign(int flen,const unsigned char *from,unsigned char *to, | ||
920 | RSA *rsa,int padding) | ||
921 | { | ||
922 | int ret=0,tlen; | ||
923 | char *hptr=NULL; | ||
924 | char msg[64]="ENGINE_rsa_sign"; | ||
925 | if (!p_surewarehk_Rsa_Sign) | ||
926 | { | ||
927 | SUREWAREerr(SUREWARE_F_SUREWAREHK_RSA_PRIV_ENC,ENGINE_R_NOT_INITIALISED); | ||
928 | } | ||
929 | /* extract ref to private key */ | ||
930 | else if (!(hptr=RSA_get_ex_data(rsa, rsaHndidx))) | ||
931 | { | ||
932 | SUREWAREerr(SUREWARE_F_SUREWAREHK_RSA_PRIV_ENC,SUREWARE_R_MISSING_KEY_COMPONENTS); | ||
933 | } | ||
934 | else | ||
935 | { | ||
936 | switch (padding) | ||
937 | { | ||
938 | case RSA_PKCS1_PADDING: /* do it in one shot */ | ||
939 | ret=p_surewarehk_Rsa_Sign(msg,flen,(unsigned char *)from,&tlen,to,hptr,SUREWARE_PKCS1_PAD); | ||
940 | surewarehk_error_handling(msg,SUREWARE_F_SUREWAREHK_RSA_PRIV_ENC,ret); | ||
941 | break; | ||
942 | case RSA_NO_PADDING: | ||
943 | default: | ||
944 | RSAerr(SUREWARE_F_SUREWAREHK_RSA_PRIV_ENC,RSA_R_UNKNOWN_PADDING_TYPE); | ||
945 | } | ||
946 | } | ||
947 | return ret==1 ? tlen : ret; | ||
948 | } | ||
949 | |||
950 | #endif | ||
951 | |||
952 | #ifndef OPENSSL_NO_DSA | ||
953 | /* DSA sign and verify */ | ||
954 | static DSA_SIG * surewarehk_dsa_do_sign(const unsigned char *from, int flen, DSA *dsa) | ||
955 | { | ||
956 | int ret=0; | ||
957 | char *hptr=NULL; | ||
958 | DSA_SIG *psign=NULL; | ||
959 | char msg[64]="ENGINE_dsa_do_sign"; | ||
960 | if (!p_surewarehk_Dsa_Sign) | ||
961 | { | ||
962 | SUREWAREerr(SUREWARE_F_SUREWAREHK_DSA_DO_SIGN,ENGINE_R_NOT_INITIALISED); | ||
963 | } | ||
964 | /* extract ref to private key */ | ||
965 | else if (!(hptr=DSA_get_ex_data(dsa, dsaHndidx))) | ||
966 | { | ||
967 | SUREWAREerr(SUREWARE_F_SUREWAREHK_DSA_DO_SIGN,SUREWARE_R_MISSING_KEY_COMPONENTS); | ||
968 | } | ||
969 | else | ||
970 | { | ||
971 | if((psign = DSA_SIG_new()) == NULL) | ||
972 | { | ||
973 | SUREWAREerr(SUREWARE_F_SUREWAREHK_DSA_DO_SIGN,ERR_R_MALLOC_FAILURE); | ||
974 | goto err; | ||
975 | } | ||
976 | psign->r=BN_new(); | ||
977 | psign->s=BN_new(); | ||
978 | bn_expand2(psign->r, 20/sizeof(BN_ULONG)); | ||
979 | bn_expand2(psign->s, 20/sizeof(BN_ULONG)); | ||
980 | if (!psign->r || psign->r->dmax!=20/sizeof(BN_ULONG) || | ||
981 | !psign->s || psign->s->dmax!=20/sizeof(BN_ULONG)) | ||
982 | goto err; | ||
983 | ret=p_surewarehk_Dsa_Sign(msg,flen,from, | ||
984 | (unsigned long *)psign->r->d, | ||
985 | (unsigned long *)psign->s->d, | ||
986 | hptr); | ||
987 | surewarehk_error_handling(msg,SUREWARE_F_SUREWAREHK_DSA_DO_SIGN,ret); | ||
988 | } | ||
989 | psign->r->top=20/sizeof(BN_ULONG); | ||
990 | bn_fix_top(psign->r); | ||
991 | psign->s->top=20/sizeof(BN_ULONG); | ||
992 | bn_fix_top(psign->s); | ||
993 | |||
994 | err: | ||
995 | if (psign) | ||
996 | { | ||
997 | DSA_SIG_free(psign); | ||
998 | psign=NULL; | ||
999 | } | ||
1000 | return psign; | ||
1001 | } | ||
1002 | #endif | ||
1003 | |||
1004 | static int surewarehk_modexp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, | ||
1005 | const BIGNUM *m, BN_CTX *ctx) | ||
1006 | { | ||
1007 | int ret=0; | ||
1008 | char msg[64]="ENGINE_modexp"; | ||
1009 | if (!p_surewarehk_Mod_Exp) | ||
1010 | { | ||
1011 | SUREWAREerr(SUREWARE_F_SUREWAREHK_MOD_EXP,ENGINE_R_NOT_INITIALISED); | ||
1012 | } | ||
1013 | else | ||
1014 | { | ||
1015 | bn_expand2(r,m->top); | ||
1016 | if (r && r->dmax==m->top) | ||
1017 | { | ||
1018 | /* do it*/ | ||
1019 | ret=p_surewarehk_Mod_Exp(msg, | ||
1020 | m->top*sizeof(BN_ULONG), | ||
1021 | (unsigned long *)m->d, | ||
1022 | p->top*sizeof(BN_ULONG), | ||
1023 | (unsigned long *)p->d, | ||
1024 | a->top*sizeof(BN_ULONG), | ||
1025 | (unsigned long *)a->d, | ||
1026 | (unsigned long *)r->d); | ||
1027 | surewarehk_error_handling(msg,SUREWARE_F_SUREWAREHK_MOD_EXP,ret); | ||
1028 | if (ret==1) | ||
1029 | { | ||
1030 | /* normalise result */ | ||
1031 | r->top=m->top; | ||
1032 | bn_fix_top(r); | ||
1033 | } | ||
1034 | } | ||
1035 | } | ||
1036 | return ret; | ||
1037 | } | ||
1038 | #endif /* !OPENSSL_NO_HW_SureWare */ | ||
1039 | #endif /* !OPENSSL_NO_HW */ | ||
diff --git a/src/lib/libcrypto/engine/hw_ubsec.c b/src/lib/libcrypto/engine/hw_ubsec.c index ed8401ec16..6286dd851c 100644 --- a/src/lib/libcrypto/engine/hw_ubsec.c +++ b/src/lib/libcrypto/engine/hw_ubsec.c | |||
@@ -242,6 +242,7 @@ static int bind_helper(ENGINE *e) | |||
242 | return 1; | 242 | return 1; |
243 | } | 243 | } |
244 | 244 | ||
245 | #ifndef ENGINE_DYNAMIC_SUPPORT | ||
245 | static ENGINE *engine_ubsec(void) | 246 | static ENGINE *engine_ubsec(void) |
246 | { | 247 | { |
247 | ENGINE *ret = ENGINE_new(); | 248 | ENGINE *ret = ENGINE_new(); |
@@ -264,6 +265,7 @@ void ENGINE_load_ubsec(void) | |||
264 | ENGINE_free(toadd); | 265 | ENGINE_free(toadd); |
265 | ERR_clear_error(); | 266 | ERR_clear_error(); |
266 | } | 267 | } |
268 | #endif | ||
267 | 269 | ||
268 | /* This is a process-global DSO handle used for loading and unloading | 270 | /* This is a process-global DSO handle used for loading and unloading |
269 | * the UBSEC library. NB: This is only set (or unset) during an | 271 | * the UBSEC library. NB: This is only set (or unset) during an |
diff --git a/src/lib/libcrypto/engine/vendor_defns/hw_ubsec.h b/src/lib/libcrypto/engine/vendor_defns/hw_ubsec.h new file mode 100644 index 0000000000..b6619d40f2 --- /dev/null +++ b/src/lib/libcrypto/engine/vendor_defns/hw_ubsec.h | |||
@@ -0,0 +1,100 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Copyright 2000 | ||
4 | * Broadcom Corporation | ||
5 | * 16215 Alton Parkway | ||
6 | * PO Box 57013 | ||
7 | * Irvine CA 92619-7013 | ||
8 | * | ||
9 | *****************************************************************************/ | ||
10 | /* | ||
11 | * Broadcom Corporation uBSec SDK | ||
12 | */ | ||
13 | /* | ||
14 | * Character device header file. | ||
15 | */ | ||
16 | /* | ||
17 | * Revision History: | ||
18 | * | ||
19 | * October 2000 JTT Created. | ||
20 | */ | ||
21 | |||
22 | #define MAX_PUBLIC_KEY_BITS (1024) | ||
23 | #define MAX_PUBLIC_KEY_BYTES (1024/8) | ||
24 | #define SHA_BIT_SIZE (160) | ||
25 | #define MAX_CRYPTO_KEY_LENGTH 24 | ||
26 | #define MAX_MAC_KEY_LENGTH 64 | ||
27 | #define UBSEC_CRYPTO_DEVICE_NAME ((unsigned char *)"/dev/ubscrypt") | ||
28 | #define UBSEC_KEY_DEVICE_NAME ((unsigned char *)"/dev/ubskey") | ||
29 | |||
30 | /* Math command types. */ | ||
31 | #define UBSEC_MATH_MODADD 0x0001 | ||
32 | #define UBSEC_MATH_MODSUB 0x0002 | ||
33 | #define UBSEC_MATH_MODMUL 0x0004 | ||
34 | #define UBSEC_MATH_MODEXP 0x0008 | ||
35 | #define UBSEC_MATH_MODREM 0x0010 | ||
36 | #define UBSEC_MATH_MODINV 0x0020 | ||
37 | |||
38 | typedef long ubsec_MathCommand_t; | ||
39 | typedef long ubsec_RNGCommand_t; | ||
40 | |||
41 | typedef struct ubsec_crypto_context_s { | ||
42 | unsigned int flags; | ||
43 | unsigned char crypto[MAX_CRYPTO_KEY_LENGTH]; | ||
44 | unsigned char auth[MAX_MAC_KEY_LENGTH]; | ||
45 | } ubsec_crypto_context_t, *ubsec_crypto_context_p; | ||
46 | |||
47 | /* | ||
48 | * Predeclare the function pointer types that we dynamically load from the DSO. | ||
49 | */ | ||
50 | |||
51 | typedef int t_UBSEC_ubsec_bytes_to_bits(unsigned char *n, int bytes); | ||
52 | |||
53 | typedef int t_UBSEC_ubsec_bits_to_bytes(int bits); | ||
54 | |||
55 | typedef int t_UBSEC_ubsec_open(unsigned char *device); | ||
56 | |||
57 | typedef int t_UBSEC_ubsec_close(int fd); | ||
58 | |||
59 | typedef int t_UBSEC_diffie_hellman_generate_ioctl (int fd, | ||
60 | unsigned char *x, int *x_len, unsigned char *y, int *y_len, | ||
61 | unsigned char *g, int g_len, unsigned char *m, int m_len, | ||
62 | unsigned char *userX, int userX_len, int random_bits); | ||
63 | |||
64 | typedef int t_UBSEC_diffie_hellman_agree_ioctl (int fd, | ||
65 | unsigned char *x, int x_len, unsigned char *y, int y_len, | ||
66 | unsigned char *m, int m_len, unsigned char *k, int *k_len); | ||
67 | |||
68 | typedef int t_UBSEC_rsa_mod_exp_ioctl (int fd, | ||
69 | unsigned char *x, int x_len, unsigned char *m, int m_len, | ||
70 | unsigned char *e, int e_len, unsigned char *y, int *y_len); | ||
71 | |||
72 | typedef int t_UBSEC_rsa_mod_exp_crt_ioctl (int fd, | ||
73 | unsigned char *x, int x_len, unsigned char *qinv, int qinv_len, | ||
74 | unsigned char *edq, int edq_len, unsigned char *q, int q_len, | ||
75 | unsigned char *edp, int edp_len, unsigned char *p, int p_len, | ||
76 | unsigned char *y, int *y_len); | ||
77 | |||
78 | typedef int t_UBSEC_dsa_sign_ioctl (int fd, | ||
79 | int hash, unsigned char *data, int data_len, | ||
80 | unsigned char *rndom, int random_len, | ||
81 | unsigned char *p, int p_len, unsigned char *q, int q_len, | ||
82 | unsigned char *g, int g_len, unsigned char *key, int key_len, | ||
83 | unsigned char *r, int *r_len, unsigned char *s, int *s_len); | ||
84 | |||
85 | typedef int t_UBSEC_dsa_verify_ioctl (int fd, | ||
86 | int hash, unsigned char *data, int data_len, | ||
87 | unsigned char *p, int p_len, unsigned char *q, int q_len, | ||
88 | unsigned char *g, int g_len, unsigned char *key, int key_len, | ||
89 | unsigned char *r, int r_len, unsigned char *s, int s_len, | ||
90 | unsigned char *v, int *v_len); | ||
91 | |||
92 | typedef int t_UBSEC_math_accelerate_ioctl(int fd, ubsec_MathCommand_t command, | ||
93 | unsigned char *ModN, int *ModN_len, unsigned char *ExpE, int *ExpE_len, | ||
94 | unsigned char *ParamA, int *ParamA_len, unsigned char *ParamB, int *ParamB_len, | ||
95 | unsigned char *Result, int *Result_len); | ||
96 | |||
97 | typedef int t_UBSEC_rng_ioctl(int fd, ubsec_RNGCommand_t command, | ||
98 | unsigned char *Result, int *Result_len); | ||
99 | |||
100 | typedef int t_UBSEC_max_key_len_ioctl(int fd, int *max_key_len); | ||
diff --git a/src/lib/libcrypto/engine/vendor_defns/hwcryptohook.h b/src/lib/libcrypto/engine/vendor_defns/hwcryptohook.h new file mode 100644 index 0000000000..aaa4d4575e --- /dev/null +++ b/src/lib/libcrypto/engine/vendor_defns/hwcryptohook.h | |||
@@ -0,0 +1,486 @@ | |||
1 | /* | ||
2 | * ModExp / RSA (with/without KM) plugin API | ||
3 | * | ||
4 | * The application will load a dynamic library which | ||
5 | * exports entrypoint(s) defined in this file. | ||
6 | * | ||
7 | * This set of entrypoints provides only a multithreaded, | ||
8 | * synchronous-within-each-thread, facility. | ||
9 | * | ||
10 | * | ||
11 | * This file is Copyright 1998-2000 nCipher Corporation Limited. | ||
12 | * | ||
13 | * Redistribution and use in source and binary forms, with opr without | ||
14 | * modification, are permitted provided that the following conditions | ||
15 | * are met: | ||
16 | * | ||
17 | * 1. Redistributions of source code must retain the copyright notice, | ||
18 | * this list of conditions, and the following disclaimer. | ||
19 | * | ||
20 | * 2. Redistributions in binary form must reproduce the above | ||
21 | * copyright notice, this list of conditions, and the following | ||
22 | * disclaimer, in the documentation and/or other materials provided | ||
23 | * with the distribution | ||
24 | * | ||
25 | * IN NO EVENT SHALL NCIPHER CORPORATION LIMITED (`NCIPHER') AND/OR | ||
26 | * ANY OTHER AUTHORS OR DISTRIBUTORS OF THIS FILE BE LIABLE for any | ||
27 | * damages arising directly or indirectly from this file, its use or | ||
28 | * this licence. Without prejudice to the generality of the | ||
29 | * foregoing: all liability shall be excluded for direct, indirect, | ||
30 | * special, incidental, consequential or other damages or any loss of | ||
31 | * profits, business, revenue goodwill or anticipated savings; | ||
32 | * liability shall be excluded even if nCipher or anyone else has been | ||
33 | * advised of the possibility of damage. In any event, if the | ||
34 | * exclusion of liability is not effective, the liability of nCipher | ||
35 | * or any author or distributor shall be limited to the lesser of the | ||
36 | * price paid and 1,000 pounds sterling. This licence only fails to | ||
37 | * exclude or limit liability for death or personal injury arising out | ||
38 | * of negligence, and only to the extent that such an exclusion or | ||
39 | * limitation is not effective. | ||
40 | * | ||
41 | * NCIPHER AND THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ALL | ||
42 | * AND ANY WARRANTIES (WHETHER EXPRESS OR IMPLIED), including, but not | ||
43 | * limited to, any implied warranties of merchantability, fitness for | ||
44 | * a particular purpose, satisfactory quality, and/or non-infringement | ||
45 | * of any third party rights. | ||
46 | * | ||
47 | * US Government use: This software and documentation is Commercial | ||
48 | * Computer Software and Computer Software Documentation, as defined in | ||
49 | * sub-paragraphs (a)(1) and (a)(5) of DFAR 252.227-7014, "Rights in | ||
50 | * Noncommercial Computer Software and Noncommercial Computer Software | ||
51 | * Documentation." Use, duplication or disclosure by the Government is | ||
52 | * subject to the terms and conditions specified here. | ||
53 | * | ||
54 | * By using or distributing this file you will be accepting these | ||
55 | * terms and conditions, including the limitation of liability and | ||
56 | * lack of warranty. If you do not wish to accept these terms and | ||
57 | * conditions, DO NOT USE THE FILE. | ||
58 | * | ||
59 | * | ||
60 | * The actual dynamically loadable plugin, and the library files for | ||
61 | * static linking, which are also provided in some distributions, are | ||
62 | * not covered by the licence described above. You should have | ||
63 | * received a separate licence with terms and conditions for these | ||
64 | * library files; if you received the library files without a licence, | ||
65 | * please contact nCipher. | ||
66 | * | ||
67 | * | ||
68 | * $Id: hwcryptohook.h,v 1.1.1.1 2003/05/11 21:35:16 markus Exp $ | ||
69 | */ | ||
70 | |||
71 | #ifndef HWCRYPTOHOOK_H | ||
72 | #define HWCRYPTOHOOK_H | ||
73 | |||
74 | #include <sys/types.h> | ||
75 | #include <stdio.h> | ||
76 | |||
77 | #ifndef HWCRYPTOHOOK_DECLARE_APPTYPES | ||
78 | #define HWCRYPTOHOOK_DECLARE_APPTYPES 1 | ||
79 | #endif | ||
80 | |||
81 | #define HWCRYPTOHOOK_ERROR_FAILED -1 | ||
82 | #define HWCRYPTOHOOK_ERROR_FALLBACK -2 | ||
83 | #define HWCRYPTOHOOK_ERROR_MPISIZE -3 | ||
84 | |||
85 | #if HWCRYPTOHOOK_DECLARE_APPTYPES | ||
86 | |||
87 | /* These structs are defined by the application and opaque to the | ||
88 | * crypto plugin. The application may define these as it sees fit. | ||
89 | * Default declarations are provided here, but the application may | ||
90 | * #define HWCRYPTOHOOK_DECLARE_APPTYPES 0 | ||
91 | * to prevent these declarations, and instead provide its own | ||
92 | * declarations of these types. (Pointers to them must still be | ||
93 | * ordinary pointers to structs or unions, or the resulting combined | ||
94 | * program will have a type inconsistency.) | ||
95 | */ | ||
96 | typedef struct HWCryptoHook_MutexValue HWCryptoHook_Mutex; | ||
97 | typedef struct HWCryptoHook_CondVarValue HWCryptoHook_CondVar; | ||
98 | typedef struct HWCryptoHook_PassphraseContextValue HWCryptoHook_PassphraseContext; | ||
99 | typedef struct HWCryptoHook_CallerContextValue HWCryptoHook_CallerContext; | ||
100 | |||
101 | #endif /* HWCRYPTOHOOK_DECLARE_APPTYPES */ | ||
102 | |||
103 | /* These next two structs are opaque to the application. The crypto | ||
104 | * plugin will return pointers to them; the caller simply manipulates | ||
105 | * the pointers. | ||
106 | */ | ||
107 | typedef struct HWCryptoHook_Context *HWCryptoHook_ContextHandle; | ||
108 | typedef struct HWCryptoHook_RSAKey *HWCryptoHook_RSAKeyHandle; | ||
109 | |||
110 | typedef struct { | ||
111 | char *buf; | ||
112 | size_t size; | ||
113 | } HWCryptoHook_ErrMsgBuf; | ||
114 | /* Used for error reporting. When a HWCryptoHook function fails it | ||
115 | * will return a sentinel value (0 for pointer-valued functions, or a | ||
116 | * negative number, usually HWCRYPTOHOOK_ERROR_FAILED, for | ||
117 | * integer-valued ones). It will, if an ErrMsgBuf is passed, also put | ||
118 | * an error message there. | ||
119 | * | ||
120 | * size is the size of the buffer, and will not be modified. If you | ||
121 | * pass 0 for size you must pass 0 for buf, and nothing will be | ||
122 | * recorded (just as if you passed 0 for the struct pointer). | ||
123 | * Messages written to the buffer will always be null-terminated, even | ||
124 | * when truncated to fit within size bytes. | ||
125 | * | ||
126 | * The contents of the buffer are not defined if there is no error. | ||
127 | */ | ||
128 | |||
129 | typedef struct HWCryptoHook_MPIStruct { | ||
130 | unsigned char *buf; | ||
131 | size_t size; | ||
132 | } HWCryptoHook_MPI; | ||
133 | /* When one of these is returned, a pointer is passed to the function. | ||
134 | * At call, size is the space available. Afterwards it is updated to | ||
135 | * be set to the actual length (which may be more than the space available, | ||
136 | * if there was not enough room and the result was truncated). | ||
137 | * buf (the pointer) is not updated. | ||
138 | * | ||
139 | * size is in bytes and may be zero at call or return, but must be a | ||
140 | * multiple of the limb size. Zero limbs at the MS end are not | ||
141 | * permitted. | ||
142 | */ | ||
143 | |||
144 | #define HWCryptoHook_InitFlags_FallbackModExp 0x0002UL | ||
145 | #define HWCryptoHook_InitFlags_FallbackRSAImmed 0x0004UL | ||
146 | /* Enable requesting fallback to software in case of problems with the | ||
147 | * hardware support. This indicates to the crypto provider that the | ||
148 | * application is prepared to fall back to software operation if the | ||
149 | * ModExp* or RSAImmed* functions return HWCRYPTOHOOK_ERROR_FALLBACK. | ||
150 | * Without this flag those calls will never return | ||
151 | * HWCRYPTOHOOK_ERROR_FALLBACK. The flag will also cause the crypto | ||
152 | * provider to avoid repeatedly attempting to contact dead hardware | ||
153 | * within a short interval, if appropriate. | ||
154 | */ | ||
155 | |||
156 | #define HWCryptoHook_InitFlags_SimpleForkCheck 0x0010UL | ||
157 | /* Without _SimpleForkCheck the library is allowed to assume that the | ||
158 | * application will not fork and call the library in the child(ren). | ||
159 | * | ||
160 | * When it is specified, this is allowed. However, after a fork | ||
161 | * neither parent nor child may unload any loaded keys or call | ||
162 | * _Finish. Instead, they should call exit (or die with a signal) | ||
163 | * without calling _Finish. After all the children have died the | ||
164 | * parent may unload keys or call _Finish. | ||
165 | * | ||
166 | * This flag only has any effect on UN*X platforms. | ||
167 | */ | ||
168 | |||
169 | typedef struct { | ||
170 | unsigned long flags; | ||
171 | void *logstream; /* usually a FILE*. See below. */ | ||
172 | |||
173 | size_t limbsize; /* bignum format - size of radix type, must be power of 2 */ | ||
174 | int mslimbfirst; /* 0 or 1 */ | ||
175 | int msbytefirst; /* 0 or 1; -1 = native */ | ||
176 | |||
177 | /* All the callback functions should return 0 on success, or a | ||
178 | * nonzero integer (whose value will be visible in the error message | ||
179 | * put in the buffer passed to the call). | ||
180 | * | ||
181 | * If a callback is not available pass a null function pointer. | ||
182 | * | ||
183 | * The callbacks may not call down again into the crypto plugin. | ||
184 | */ | ||
185 | |||
186 | /* For thread-safety. Set everything to 0 if you promise only to be | ||
187 | * singlethreaded. maxsimultaneous is the number of calls to | ||
188 | * ModExp[Crt]/RSAImmed{Priv,Pub}/RSA. If you don't know what to | ||
189 | * put there then say 0 and the hook library will use a default. | ||
190 | * | ||
191 | * maxmutexes is a small limit on the number of simultaneous mutexes | ||
192 | * which will be requested by the library. If there is no small | ||
193 | * limit, set it to 0. If the crypto plugin cannot create the | ||
194 | * advertised number of mutexes the calls to its functions may fail. | ||
195 | * If a low number of mutexes is advertised the plugin will try to | ||
196 | * do the best it can. Making larger numbers of mutexes available | ||
197 | * may improve performance and parallelism by reducing contention | ||
198 | * over critical sections. Unavailability of any mutexes, implying | ||
199 | * single-threaded operation, should be indicated by the setting | ||
200 | * mutex_init et al to 0. | ||
201 | */ | ||
202 | int maxmutexes; | ||
203 | int maxsimultaneous; | ||
204 | size_t mutexsize; | ||
205 | int (*mutex_init)(HWCryptoHook_Mutex*, HWCryptoHook_CallerContext *cactx); | ||
206 | int (*mutex_acquire)(HWCryptoHook_Mutex*); | ||
207 | void (*mutex_release)(HWCryptoHook_Mutex*); | ||
208 | void (*mutex_destroy)(HWCryptoHook_Mutex*); | ||
209 | |||
210 | /* For greater efficiency, can use condition vars internally for | ||
211 | * synchronisation. In this case maxsimultaneous is ignored, but | ||
212 | * the other mutex stuff must be available. In singlethreaded | ||
213 | * programs, set everything to 0. | ||
214 | */ | ||
215 | size_t condvarsize; | ||
216 | int (*condvar_init)(HWCryptoHook_CondVar*, HWCryptoHook_CallerContext *cactx); | ||
217 | int (*condvar_wait)(HWCryptoHook_CondVar*, HWCryptoHook_Mutex*); | ||
218 | void (*condvar_signal)(HWCryptoHook_CondVar*); | ||
219 | void (*condvar_broadcast)(HWCryptoHook_CondVar*); | ||
220 | void (*condvar_destroy)(HWCryptoHook_CondVar*); | ||
221 | |||
222 | /* The semantics of acquiring and releasing mutexes and broadcasting | ||
223 | * and waiting on condition variables are expected to be those from | ||
224 | * POSIX threads (pthreads). The mutexes may be (in pthread-speak) | ||
225 | * fast mutexes, recursive mutexes, or nonrecursive ones. | ||
226 | * | ||
227 | * The _release/_signal/_broadcast and _destroy functions must | ||
228 | * always succeed when given a valid argument; if they are given an | ||
229 | * invalid argument then the program (crypto plugin + application) | ||
230 | * has an internal error, and they should abort the program. | ||
231 | */ | ||
232 | |||
233 | int (*getpassphrase)(const char *prompt_info, | ||
234 | int *len_io, char *buf, | ||
235 | HWCryptoHook_PassphraseContext *ppctx, | ||
236 | HWCryptoHook_CallerContext *cactx); | ||
237 | /* Passphrases and the prompt_info, if they contain high-bit-set | ||
238 | * characters, are UTF-8. The prompt_info may be a null pointer if | ||
239 | * no prompt information is available (it should not be an empty | ||
240 | * string). It will not contain text like `enter passphrase'; | ||
241 | * instead it might say something like `Operator Card for John | ||
242 | * Smith' or `SmartCard in nFast Module #1, Slot #1'. | ||
243 | * | ||
244 | * buf points to a buffer in which to return the passphrase; on | ||
245 | * entry *len_io is the length of the buffer. It should be updated | ||
246 | * by the callback. The returned passphrase should not be | ||
247 | * null-terminated by the callback. | ||
248 | */ | ||
249 | |||
250 | int (*getphystoken)(const char *prompt_info, | ||
251 | const char *wrong_info, | ||
252 | HWCryptoHook_PassphraseContext *ppctx, | ||
253 | HWCryptoHook_CallerContext *cactx); | ||
254 | /* Requests that the human user physically insert a different | ||
255 | * smartcard, DataKey, etc. The plugin should check whether the | ||
256 | * currently inserted token(s) are appropriate, and if they are it | ||
257 | * should not make this call. | ||
258 | * | ||
259 | * prompt_info is as before. wrong_info is a description of the | ||
260 | * currently inserted token(s) so that the user is told what | ||
261 | * something is. wrong_info, like prompt_info, may be null, but | ||
262 | * should not be an empty string. Its contents should be | ||
263 | * syntactically similar to that of prompt_info. | ||
264 | */ | ||
265 | |||
266 | /* Note that a single LoadKey operation might cause several calls to | ||
267 | * getpassphrase and/or requestphystoken. If requestphystoken is | ||
268 | * not provided (ie, a null pointer is passed) then the plugin may | ||
269 | * not support loading keys for which authorisation by several cards | ||
270 | * is required. If getpassphrase is not provided then cards with | ||
271 | * passphrases may not be supported. | ||
272 | * | ||
273 | * getpassphrase and getphystoken do not need to check that the | ||
274 | * passphrase has been entered correctly or the correct token | ||
275 | * inserted; the crypto plugin will do that. If this is not the | ||
276 | * case then the crypto plugin is responsible for calling these | ||
277 | * routines again as appropriate until the correct token(s) and | ||
278 | * passphrase(s) are supplied as required, or until any retry limits | ||
279 | * implemented by the crypto plugin are reached. | ||
280 | * | ||
281 | * In either case, the application must allow the user to say `no' | ||
282 | * or `cancel' to indicate that they do not know the passphrase or | ||
283 | * have the appropriate token; this should cause the callback to | ||
284 | * return nonzero indicating error. | ||
285 | */ | ||
286 | |||
287 | void (*logmessage)(void *logstream, const char *message); | ||
288 | /* A log message will be generated at least every time something goes | ||
289 | * wrong and an ErrMsgBuf is filled in (or would be if one was | ||
290 | * provided). Other diagnostic information may be written there too, | ||
291 | * including more detailed reasons for errors which are reported in an | ||
292 | * ErrMsgBuf. | ||
293 | * | ||
294 | * When a log message is generated, this callback is called. It | ||
295 | * should write a message to the relevant logging arrangements. | ||
296 | * | ||
297 | * The message string passed will be null-terminated and may be of arbitrary | ||
298 | * length. It will not be prefixed by the time and date, nor by the | ||
299 | * name of the library that is generating it - if this is required, | ||
300 | * the logmessage callback must do it. The message will not have a | ||
301 | * trailing newline (though it may contain internal newlines). | ||
302 | * | ||
303 | * If a null pointer is passed for logmessage a default function is | ||
304 | * used. The default function treats logstream as a FILE* which has | ||
305 | * been converted to a void*. If logstream is 0 it does nothing. | ||
306 | * Otherwise it prepends the date and time and library name and | ||
307 | * writes the message to logstream. Each line will be prefixed by a | ||
308 | * descriptive string containing the date, time and identity of the | ||
309 | * crypto plugin. Errors on the logstream are not reported | ||
310 | * anywhere, and the default function doesn't flush the stream, so | ||
311 | * the application must set the buffering how it wants it. | ||
312 | * | ||
313 | * The crypto plugin may also provide a facility to have copies of | ||
314 | * log messages sent elsewhere, and or for adjusting the verbosity | ||
315 | * of the log messages; any such facilities will be configured by | ||
316 | * external means. | ||
317 | */ | ||
318 | |||
319 | } HWCryptoHook_InitInfo; | ||
320 | |||
321 | typedef | ||
322 | HWCryptoHook_ContextHandle HWCryptoHook_Init_t(const HWCryptoHook_InitInfo *initinfo, | ||
323 | size_t initinfosize, | ||
324 | const HWCryptoHook_ErrMsgBuf *errors, | ||
325 | HWCryptoHook_CallerContext *cactx); | ||
326 | extern HWCryptoHook_Init_t HWCryptoHook_Init; | ||
327 | |||
328 | /* Caller should set initinfosize to the size of the HWCryptoHook struct, | ||
329 | * so it can be extended later. | ||
330 | * | ||
331 | * On success, a message for display or logging by the server, | ||
332 | * including the name and version number of the plugin, will be filled | ||
333 | * in into *errors; on failure *errors is used for error handling, as | ||
334 | * usual. | ||
335 | */ | ||
336 | |||
337 | /* All these functions return 0 on success, HWCRYPTOHOOK_ERROR_FAILED | ||
338 | * on most failures. HWCRYPTOHOOK_ERROR_MPISIZE means at least one of | ||
339 | * the output MPI buffer(s) was too small; the sizes of all have been | ||
340 | * set to the desired size (and for those where the buffer was large | ||
341 | * enough, the value may have been copied in), and no error message | ||
342 | * has been recorded. | ||
343 | * | ||
344 | * You may pass 0 for the errors struct. In any case, unless you set | ||
345 | * _NoStderr at init time then messages may be reported to stderr. | ||
346 | */ | ||
347 | |||
348 | /* The RSAImmed* functions (and key managed RSA) only work with | ||
349 | * modules which have an RSA patent licence - currently that means KM | ||
350 | * units; the ModExp* ones work with all modules, so you need a patent | ||
351 | * licence in the software in the US. They are otherwise identical. | ||
352 | */ | ||
353 | |||
354 | typedef | ||
355 | void HWCryptoHook_Finish_t(HWCryptoHook_ContextHandle hwctx); | ||
356 | extern HWCryptoHook_Finish_t HWCryptoHook_Finish; | ||
357 | /* You must not have any calls going or keys loaded when you call this. */ | ||
358 | |||
359 | typedef | ||
360 | int HWCryptoHook_RandomBytes_t(HWCryptoHook_ContextHandle hwctx, | ||
361 | unsigned char *buf, size_t len, | ||
362 | const HWCryptoHook_ErrMsgBuf *errors); | ||
363 | extern HWCryptoHook_RandomBytes_t HWCryptoHook_RandomBytes; | ||
364 | |||
365 | typedef | ||
366 | int HWCryptoHook_ModExp_t(HWCryptoHook_ContextHandle hwctx, | ||
367 | HWCryptoHook_MPI a, | ||
368 | HWCryptoHook_MPI p, | ||
369 | HWCryptoHook_MPI n, | ||
370 | HWCryptoHook_MPI *r, | ||
371 | const HWCryptoHook_ErrMsgBuf *errors); | ||
372 | extern HWCryptoHook_ModExp_t HWCryptoHook_ModExp; | ||
373 | |||
374 | typedef | ||
375 | int HWCryptoHook_RSAImmedPub_t(HWCryptoHook_ContextHandle hwctx, | ||
376 | HWCryptoHook_MPI m, | ||
377 | HWCryptoHook_MPI e, | ||
378 | HWCryptoHook_MPI n, | ||
379 | HWCryptoHook_MPI *r, | ||
380 | const HWCryptoHook_ErrMsgBuf *errors); | ||
381 | extern HWCryptoHook_RSAImmedPub_t HWCryptoHook_RSAImmedPub; | ||
382 | |||
383 | typedef | ||
384 | int HWCryptoHook_ModExpCRT_t(HWCryptoHook_ContextHandle hwctx, | ||
385 | HWCryptoHook_MPI a, | ||
386 | HWCryptoHook_MPI p, | ||
387 | HWCryptoHook_MPI q, | ||
388 | HWCryptoHook_MPI dmp1, | ||
389 | HWCryptoHook_MPI dmq1, | ||
390 | HWCryptoHook_MPI iqmp, | ||
391 | HWCryptoHook_MPI *r, | ||
392 | const HWCryptoHook_ErrMsgBuf *errors); | ||
393 | extern HWCryptoHook_ModExpCRT_t HWCryptoHook_ModExpCRT; | ||
394 | |||
395 | typedef | ||
396 | int HWCryptoHook_RSAImmedPriv_t(HWCryptoHook_ContextHandle hwctx, | ||
397 | HWCryptoHook_MPI m, | ||
398 | HWCryptoHook_MPI p, | ||
399 | HWCryptoHook_MPI q, | ||
400 | HWCryptoHook_MPI dmp1, | ||
401 | HWCryptoHook_MPI dmq1, | ||
402 | HWCryptoHook_MPI iqmp, | ||
403 | HWCryptoHook_MPI *r, | ||
404 | const HWCryptoHook_ErrMsgBuf *errors); | ||
405 | extern HWCryptoHook_RSAImmedPriv_t HWCryptoHook_RSAImmedPriv; | ||
406 | |||
407 | /* The RSAImmed* and ModExp* functions may return E_FAILED or | ||
408 | * E_FALLBACK for failure. | ||
409 | * | ||
410 | * E_FAILED means the failure is permanent and definite and there | ||
411 | * should be no attempt to fall back to software. (Eg, for some | ||
412 | * applications, which support only the acceleration-only | ||
413 | * functions, the `key material' may actually be an encoded key | ||
414 | * identifier, and doing the operation in software would give wrong | ||
415 | * answers.) | ||
416 | * | ||
417 | * E_FALLBACK means that doing the computation in software would seem | ||
418 | * reasonable. If an application pays attention to this and is | ||
419 | * able to fall back, it should also set the Fallback init flags. | ||
420 | */ | ||
421 | |||
422 | typedef | ||
423 | int HWCryptoHook_RSALoadKey_t(HWCryptoHook_ContextHandle hwctx, | ||
424 | const char *key_ident, | ||
425 | HWCryptoHook_RSAKeyHandle *keyhandle_r, | ||
426 | const HWCryptoHook_ErrMsgBuf *errors, | ||
427 | HWCryptoHook_PassphraseContext *ppctx); | ||
428 | extern HWCryptoHook_RSALoadKey_t HWCryptoHook_RSALoadKey; | ||
429 | /* The key_ident is a null-terminated string configured by the | ||
430 | * user via the application's usual configuration mechanisms. | ||
431 | * It is provided to the user by the crypto provider's key management | ||
432 | * system. The user must be able to enter at least any string of between | ||
433 | * 1 and 1023 characters inclusive, consisting of printable 7-bit | ||
434 | * ASCII characters. The provider should avoid using | ||
435 | * any characters except alphanumerics and the punctuation | ||
436 | * characters _ - + . / @ ~ (the user is expected to be able | ||
437 | * to enter these without quoting). The string may be case-sensitive. | ||
438 | * The application may allow the user to enter other NULL-terminated strings, | ||
439 | * and the provider must cope (returning an error if the string is not | ||
440 | * valid). | ||
441 | * | ||
442 | * If the key does not exist, no error is recorded and 0 is returned; | ||
443 | * keyhandle_r will be set to 0 instead of to a key handle. | ||
444 | */ | ||
445 | |||
446 | typedef | ||
447 | int HWCryptoHook_RSAGetPublicKey_t(HWCryptoHook_RSAKeyHandle k, | ||
448 | HWCryptoHook_MPI *n, | ||
449 | HWCryptoHook_MPI *e, | ||
450 | const HWCryptoHook_ErrMsgBuf *errors); | ||
451 | extern HWCryptoHook_RSAGetPublicKey_t HWCryptoHook_RSAGetPublicKey; | ||
452 | /* The crypto plugin will not store certificates. | ||
453 | * | ||
454 | * Although this function for acquiring the public key value is | ||
455 | * provided, it is not the purpose of this API to deal fully with the | ||
456 | * handling of the public key. | ||
457 | * | ||
458 | * It is expected that the crypto supplier's key generation program | ||
459 | * will provide general facilities for producing X.509 | ||
460 | * self-certificates and certificate requests in PEM format. These | ||
461 | * will be given to the user so that they can configure them in the | ||
462 | * application, send them to CAs, or whatever. | ||
463 | * | ||
464 | * In case this kind of certificate handling is not appropriate, the | ||
465 | * crypto supplier's key generation program should be able to be | ||
466 | * configured not to generate such a self-certificate or certificate | ||
467 | * request. Then the application will need to do all of this, and | ||
468 | * will need to store and handle the public key and certificates | ||
469 | * itself. | ||
470 | */ | ||
471 | |||
472 | typedef | ||
473 | int HWCryptoHook_RSAUnloadKey_t(HWCryptoHook_RSAKeyHandle k, | ||
474 | const HWCryptoHook_ErrMsgBuf *errors); | ||
475 | extern HWCryptoHook_RSAUnloadKey_t HWCryptoHook_RSAUnloadKey; | ||
476 | /* Might fail due to locking problems, or other serious internal problems. */ | ||
477 | |||
478 | typedef | ||
479 | int HWCryptoHook_RSA_t(HWCryptoHook_MPI m, | ||
480 | HWCryptoHook_RSAKeyHandle k, | ||
481 | HWCryptoHook_MPI *r, | ||
482 | const HWCryptoHook_ErrMsgBuf *errors); | ||
483 | extern HWCryptoHook_RSA_t HWCryptoHook_RSA; | ||
484 | /* RSA private key operation (sign or decrypt) - raw, unpadded. */ | ||
485 | |||
486 | #endif /*HWCRYPTOHOOK_H*/ | ||
diff --git a/src/lib/libcrypto/engine/vendor_defns/sureware.h b/src/lib/libcrypto/engine/vendor_defns/sureware.h new file mode 100644 index 0000000000..1d3789219d --- /dev/null +++ b/src/lib/libcrypto/engine/vendor_defns/sureware.h | |||
@@ -0,0 +1,239 @@ | |||
1 | /* | ||
2 | * Written by Corinne Dive-Reclus(cdive@baltimore.com) | ||
3 | * | ||
4 | * Copyright@2001 Baltimore Technologies Ltd. | ||
5 | * * | ||
6 | * THIS FILE IS PROVIDED BY BALTIMORE TECHNOLOGIES ``AS IS'' AND * | ||
7 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * | ||
8 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * | ||
9 | * ARE DISCLAIMED. IN NO EVENT SHALL BALTIMORE TECHNOLOGIES BE LIABLE * | ||
10 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * | ||
11 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * | ||
12 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * | ||
13 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * | ||
14 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * | ||
15 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * | ||
16 | * SUCH DAMAGE. * | ||
17 | * | ||
18 | * | ||
19 | */ | ||
20 | #ifdef WIN32 | ||
21 | #define SW_EXPORT __declspec ( dllexport ) | ||
22 | #else | ||
23 | #define SW_EXPORT | ||
24 | #endif | ||
25 | |||
26 | /* | ||
27 | * List of exposed SureWare errors | ||
28 | */ | ||
29 | #define SUREWAREHOOK_ERROR_FAILED -1 | ||
30 | #define SUREWAREHOOK_ERROR_FALLBACK -2 | ||
31 | #define SUREWAREHOOK_ERROR_UNIT_FAILURE -3 | ||
32 | #define SUREWAREHOOK_ERROR_DATA_SIZE -4 | ||
33 | #define SUREWAREHOOK_ERROR_INVALID_PAD -5 | ||
34 | /* | ||
35 | * -----------------WARNING----------------------------------- | ||
36 | * In all the following functions: | ||
37 | * msg is a string with at least 24 bytes free. | ||
38 | * A 24 bytes string will be concatenated to the existing content of msg. | ||
39 | */ | ||
40 | /* | ||
41 | * SureWare Initialisation function | ||
42 | * in param threadsafe, if !=0, thread safe enabled | ||
43 | * return SureWareHOOK_ERROR_UNIT_FAILURE if failure, 1 if success | ||
44 | */ | ||
45 | typedef int SureWareHook_Init_t(char*const msg,int threadsafe); | ||
46 | extern SW_EXPORT SureWareHook_Init_t SureWareHook_Init; | ||
47 | /* | ||
48 | * SureWare Finish function | ||
49 | */ | ||
50 | typedef void SureWareHook_Finish_t(); | ||
51 | extern SW_EXPORT SureWareHook_Finish_t SureWareHook_Finish; | ||
52 | /* | ||
53 | * PRE_CONDITION: | ||
54 | * DO NOT CALL ANY OF THE FOLLOWING FUNCTIONS IN CASE OF INIT FAILURE | ||
55 | */ | ||
56 | /* | ||
57 | * SureWare RAND Bytes function | ||
58 | * In case of failure, the content of buf is unpredictable. | ||
59 | * return 1 if success | ||
60 | * SureWareHOOK_ERROR_FALLBACK if function not available in hardware | ||
61 | * SureWareHOOK_ERROR_FAILED if error while processing | ||
62 | * SureWareHOOK_ERROR_UNIT_FAILURE if hardware failure | ||
63 | * SUREWAREHOOK_ERROR_DATA_SIZE wrong size for buf | ||
64 | * | ||
65 | * in/out param buf : a num bytes long buffer where random bytes will be put | ||
66 | * in param num : the number of bytes into buf | ||
67 | */ | ||
68 | typedef int SureWareHook_Rand_Bytes_t(char*const msg,unsigned char *buf, int num); | ||
69 | extern SW_EXPORT SureWareHook_Rand_Bytes_t SureWareHook_Rand_Bytes; | ||
70 | |||
71 | /* | ||
72 | * SureWare RAND Seed function | ||
73 | * Adds some seed to the Hardware Random Number Generator | ||
74 | * return 1 if success | ||
75 | * SureWareHOOK_ERROR_FALLBACK if function not available in hardware | ||
76 | * SureWareHOOK_ERROR_FAILED if error while processing | ||
77 | * SureWareHOOK_ERROR_UNIT_FAILURE if hardware failure | ||
78 | * SUREWAREHOOK_ERROR_DATA_SIZE wrong size for buf | ||
79 | * | ||
80 | * in param buf : the seed to add into the HRNG | ||
81 | * in param num : the number of bytes into buf | ||
82 | */ | ||
83 | typedef int SureWareHook_Rand_Seed_t(char*const msg,const void *buf, int num); | ||
84 | extern SW_EXPORT SureWareHook_Rand_Seed_t SureWareHook_Rand_Seed; | ||
85 | |||
86 | /* | ||
87 | * SureWare Load Private Key function | ||
88 | * return 1 if success | ||
89 | * SureWareHOOK_ERROR_FAILED if error while processing | ||
90 | * No hardware is contact for this function. | ||
91 | * | ||
92 | * in param key_id :the name of the private protected key file without the extension | ||
93 | ".sws" | ||
94 | * out param hptr : a pointer to a buffer allocated by SureWare_Hook | ||
95 | * out param num: the effective key length in bytes | ||
96 | * out param keytype: 1 if RSA 2 if DSA | ||
97 | */ | ||
98 | typedef int SureWareHook_Load_Privkey_t(char*const msg,const char *key_id,char **hptr,unsigned long *num,char *keytype); | ||
99 | extern SW_EXPORT SureWareHook_Load_Privkey_t SureWareHook_Load_Privkey; | ||
100 | |||
101 | /* | ||
102 | * SureWare Info Public Key function | ||
103 | * return 1 if success | ||
104 | * SureWareHOOK_ERROR_FAILED if error while processing | ||
105 | * No hardware is contact for this function. | ||
106 | * | ||
107 | * in param key_id :the name of the private protected key file without the extension | ||
108 | ".swp" | ||
109 | * out param hptr : a pointer to a buffer allocated by SureWare_Hook | ||
110 | * out param num: the effective key length in bytes | ||
111 | * out param keytype: 1 if RSA 2 if DSA | ||
112 | */ | ||
113 | typedef int SureWareHook_Info_Pubkey_t(char*const msg,const char *key_id,unsigned long *num, | ||
114 | char *keytype); | ||
115 | extern SW_EXPORT SureWareHook_Info_Pubkey_t SureWareHook_Info_Pubkey; | ||
116 | |||
117 | /* | ||
118 | * SureWare Load Public Key function | ||
119 | * return 1 if success | ||
120 | * SureWareHOOK_ERROR_FAILED if error while processing | ||
121 | * No hardware is contact for this function. | ||
122 | * | ||
123 | * in param key_id :the name of the public protected key file without the extension | ||
124 | ".swp" | ||
125 | * in param num : the bytes size of n and e | ||
126 | * out param n: where to write modulus in bn format | ||
127 | * out param e: where to write exponent in bn format | ||
128 | */ | ||
129 | typedef int SureWareHook_Load_Rsa_Pubkey_t(char*const msg,const char *key_id,unsigned long num, | ||
130 | unsigned long *n, unsigned long *e); | ||
131 | extern SW_EXPORT SureWareHook_Load_Rsa_Pubkey_t SureWareHook_Load_Rsa_Pubkey; | ||
132 | |||
133 | /* | ||
134 | * SureWare Load DSA Public Key function | ||
135 | * return 1 if success | ||
136 | * SureWareHOOK_ERROR_FAILED if error while processing | ||
137 | * No hardware is contact for this function. | ||
138 | * | ||
139 | * in param key_id :the name of the public protected key file without the extension | ||
140 | ".swp" | ||
141 | * in param num : the bytes size of n and e | ||
142 | * out param pub: where to write pub key in bn format | ||
143 | * out param p: where to write prime in bn format | ||
144 | * out param q: where to write sunprime (length 20 bytes) in bn format | ||
145 | * out param g: where to write base in bn format | ||
146 | */ | ||
147 | typedef int SureWareHook_Load_Dsa_Pubkey_t(char*const msg,const char *key_id,unsigned long num, | ||
148 | unsigned long *pub, unsigned long *p,unsigned long*q, | ||
149 | unsigned long *g); | ||
150 | extern SW_EXPORT SureWareHook_Load_Dsa_Pubkey_t SureWareHook_Load_Dsa_Pubkey; | ||
151 | |||
152 | /* | ||
153 | * SureWare Free function | ||
154 | * Destroy the key into the hardware if destroy==1 | ||
155 | */ | ||
156 | typedef void SureWareHook_Free_t(char *p,int destroy); | ||
157 | extern SW_EXPORT SureWareHook_Free_t SureWareHook_Free; | ||
158 | |||
159 | #define SUREWARE_PKCS1_PAD 1 | ||
160 | #define SUREWARE_ISO9796_PAD 2 | ||
161 | #define SUREWARE_NO_PAD 0 | ||
162 | /* | ||
163 | * SureWare RSA Private Decryption | ||
164 | * return 1 if success | ||
165 | * SureWareHOOK_ERROR_FAILED if error while processing | ||
166 | * SureWareHOOK_ERROR_UNIT_FAILURE if hardware failure | ||
167 | * SUREWAREHOOK_ERROR_DATA_SIZE wrong size for buf | ||
168 | * | ||
169 | * in param flen : byte size of from and to | ||
170 | * in param from : encrypted data buffer, should be a not-null valid pointer | ||
171 | * out param tlen: byte size of decrypted data, if error, unexpected value | ||
172 | * out param to : decrypted data buffer, should be a not-null valid pointer | ||
173 | * in param prsa: a protected key pointer, should be a not-null valid pointer | ||
174 | * int padding: padding id as follow | ||
175 | * SUREWARE_PKCS1_PAD | ||
176 | * SUREWARE_NO_PAD | ||
177 | * | ||
178 | */ | ||
179 | typedef int SureWareHook_Rsa_Priv_Dec_t(char*const msg,int flen,unsigned char *from, | ||
180 | int *tlen,unsigned char *to, | ||
181 | char *prsa,int padding); | ||
182 | extern SW_EXPORT SureWareHook_Rsa_Priv_Dec_t SureWareHook_Rsa_Priv_Dec; | ||
183 | /* | ||
184 | * SureWare RSA Signature | ||
185 | * return 1 if success | ||
186 | * SureWareHOOK_ERROR_FAILED if error while processing | ||
187 | * SureWareHOOK_ERROR_UNIT_FAILURE if hardware failure | ||
188 | * SUREWAREHOOK_ERROR_DATA_SIZE wrong size for buf | ||
189 | * | ||
190 | * in param flen : byte size of from and to | ||
191 | * in param from : encrypted data buffer, should be a not-null valid pointer | ||
192 | * out param tlen: byte size of decrypted data, if error, unexpected value | ||
193 | * out param to : decrypted data buffer, should be a not-null valid pointer | ||
194 | * in param prsa: a protected key pointer, should be a not-null valid pointer | ||
195 | * int padding: padding id as follow | ||
196 | * SUREWARE_PKCS1_PAD | ||
197 | * SUREWARE_ISO9796_PAD | ||
198 | * | ||
199 | */ | ||
200 | typedef int SureWareHook_Rsa_Sign_t(char*const msg,int flen,unsigned char *from, | ||
201 | int *tlen,unsigned char *to, | ||
202 | char *prsa,int padding); | ||
203 | extern SW_EXPORT SureWareHook_Rsa_Sign_t SureWareHook_Rsa_Sign; | ||
204 | /* | ||
205 | * SureWare DSA Signature | ||
206 | * return 1 if success | ||
207 | * SureWareHOOK_ERROR_FAILED if error while processing | ||
208 | * SureWareHOOK_ERROR_UNIT_FAILURE if hardware failure | ||
209 | * SUREWAREHOOK_ERROR_DATA_SIZE wrong size for buf | ||
210 | * | ||
211 | * in param flen : byte size of from and to | ||
212 | * in param from : encrypted data buffer, should be a not-null valid pointer | ||
213 | * out param to : decrypted data buffer, should be a 40bytes valid pointer | ||
214 | * in param pdsa: a protected key pointer, should be a not-null valid pointer | ||
215 | * | ||
216 | */ | ||
217 | typedef int SureWareHook_Dsa_Sign_t(char*const msg,int flen,const unsigned char *from, | ||
218 | unsigned long *r,unsigned long *s,char *pdsa); | ||
219 | extern SW_EXPORT SureWareHook_Dsa_Sign_t SureWareHook_Dsa_Sign; | ||
220 | |||
221 | |||
222 | /* | ||
223 | * SureWare Mod Exp | ||
224 | * return 1 if success | ||
225 | * SureWareHOOK_ERROR_FAILED if error while processing | ||
226 | * SureWareHOOK_ERROR_UNIT_FAILURE if hardware failure | ||
227 | * SUREWAREHOOK_ERROR_DATA_SIZE wrong size for buf | ||
228 | * | ||
229 | * mod and res are mlen bytes long. | ||
230 | * exp is elen bytes long | ||
231 | * data is dlen bytes long | ||
232 | * mlen,elen and dlen are all multiple of sizeof(unsigned long) | ||
233 | */ | ||
234 | typedef int SureWareHook_Mod_Exp_t(char*const msg,int mlen,const unsigned long *mod, | ||
235 | int elen,const unsigned long *exp, | ||
236 | int dlen,unsigned long *data, | ||
237 | unsigned long *res); | ||
238 | extern SW_EXPORT SureWareHook_Mod_Exp_t SureWareHook_Mod_Exp; | ||
239 | |||
diff --git a/src/lib/libcrypto/evp/bio_ok.c b/src/lib/libcrypto/evp/bio_ok.c index 3cbc6e7848..530ab937ce 100644 --- a/src/lib/libcrypto/evp/bio_ok.c +++ b/src/lib/libcrypto/evp/bio_ok.c | |||
@@ -211,7 +211,7 @@ static int ok_free(BIO *a) | |||
211 | { | 211 | { |
212 | if (a == NULL) return(0); | 212 | if (a == NULL) return(0); |
213 | EVP_MD_CTX_cleanup(&((BIO_OK_CTX *)a->ptr)->md); | 213 | EVP_MD_CTX_cleanup(&((BIO_OK_CTX *)a->ptr)->md); |
214 | memset(a->ptr,0,sizeof(BIO_OK_CTX)); | 214 | OPENSSL_cleanse(a->ptr,sizeof(BIO_OK_CTX)); |
215 | OPENSSL_free(a->ptr); | 215 | OPENSSL_free(a->ptr); |
216 | a->ptr=NULL; | 216 | a->ptr=NULL; |
217 | a->init=0; | 217 | a->init=0; |
diff --git a/src/lib/libcrypto/evp/evp_acnf.c b/src/lib/libcrypto/evp/evp_acnf.c index a68b979bdb..ff3e311cc5 100644 --- a/src/lib/libcrypto/evp/evp_acnf.c +++ b/src/lib/libcrypto/evp/evp_acnf.c | |||
@@ -59,7 +59,6 @@ | |||
59 | #include "cryptlib.h" | 59 | #include "cryptlib.h" |
60 | #include <openssl/evp.h> | 60 | #include <openssl/evp.h> |
61 | #include <openssl/conf.h> | 61 | #include <openssl/conf.h> |
62 | #include <openssl/engine.h> | ||
63 | 62 | ||
64 | 63 | ||
65 | /* Load all algorithms and configure OpenSSL. | 64 | /* Load all algorithms and configure OpenSSL. |
diff --git a/src/lib/libcrypto/evp/evp_test.c b/src/lib/libcrypto/evp/evp_test.c index 90294ef686..28460173f7 100644 --- a/src/lib/libcrypto/evp/evp_test.c +++ b/src/lib/libcrypto/evp/evp_test.c | |||
@@ -49,8 +49,14 @@ | |||
49 | 49 | ||
50 | #include <stdio.h> | 50 | #include <stdio.h> |
51 | #include <string.h> | 51 | #include <string.h> |
52 | |||
53 | #include "../e_os.h" | ||
54 | |||
52 | #include <openssl/evp.h> | 55 | #include <openssl/evp.h> |
56 | #ifndef OPENSSL_NO_ENGINE | ||
53 | #include <openssl/engine.h> | 57 | #include <openssl/engine.h> |
58 | #endif | ||
59 | #include <openssl/err.h> | ||
54 | #include <openssl/conf.h> | 60 | #include <openssl/conf.h> |
55 | 61 | ||
56 | static void hexdump(FILE *f,const char *title,const unsigned char *s,int l) | 62 | static void hexdump(FILE *f,const char *title,const unsigned char *s,int l) |
@@ -78,7 +84,7 @@ static int convert(unsigned char *s) | |||
78 | if(!s[1]) | 84 | if(!s[1]) |
79 | { | 85 | { |
80 | fprintf(stderr,"Odd number of hex digits!"); | 86 | fprintf(stderr,"Odd number of hex digits!"); |
81 | exit(4); | 87 | EXIT(4); |
82 | } | 88 | } |
83 | sscanf((char *)s,"%2x",&n); | 89 | sscanf((char *)s,"%2x",&n); |
84 | *d=(unsigned char)n; | 90 | *d=(unsigned char)n; |
@@ -120,6 +126,12 @@ static char *sstrsep(char **string, const char *delim) | |||
120 | static unsigned char *ustrsep(char **p,const char *sep) | 126 | static unsigned char *ustrsep(char **p,const char *sep) |
121 | { return (unsigned char *)sstrsep(p,sep); } | 127 | { return (unsigned char *)sstrsep(p,sep); } |
122 | 128 | ||
129 | static int test1_exit(int ec) | ||
130 | { | ||
131 | EXIT(ec); | ||
132 | return(0); /* To keep some compilers quiet */ | ||
133 | } | ||
134 | |||
123 | static void test1(const EVP_CIPHER *c,const unsigned char *key,int kn, | 135 | static void test1(const EVP_CIPHER *c,const unsigned char *key,int kn, |
124 | const unsigned char *iv,int in, | 136 | const unsigned char *iv,int in, |
125 | const unsigned char *plaintext,int pn, | 137 | const unsigned char *plaintext,int pn, |
@@ -142,7 +154,7 @@ static void test1(const EVP_CIPHER *c,const unsigned char *key,int kn, | |||
142 | { | 154 | { |
143 | fprintf(stderr,"Key length doesn't match, got %d expected %d\n",kn, | 155 | fprintf(stderr,"Key length doesn't match, got %d expected %d\n",kn, |
144 | c->key_len); | 156 | c->key_len); |
145 | exit(5); | 157 | test1_exit(5); |
146 | } | 158 | } |
147 | EVP_CIPHER_CTX_init(&ctx); | 159 | EVP_CIPHER_CTX_init(&ctx); |
148 | if (encdec != 0) | 160 | if (encdec != 0) |
@@ -150,26 +162,26 @@ static void test1(const EVP_CIPHER *c,const unsigned char *key,int kn, | |||
150 | if(!EVP_EncryptInit_ex(&ctx,c,NULL,key,iv)) | 162 | if(!EVP_EncryptInit_ex(&ctx,c,NULL,key,iv)) |
151 | { | 163 | { |
152 | fprintf(stderr,"EncryptInit failed\n"); | 164 | fprintf(stderr,"EncryptInit failed\n"); |
153 | exit(10); | 165 | test1_exit(10); |
154 | } | 166 | } |
155 | EVP_CIPHER_CTX_set_padding(&ctx,0); | 167 | EVP_CIPHER_CTX_set_padding(&ctx,0); |
156 | 168 | ||
157 | if(!EVP_EncryptUpdate(&ctx,out,&outl,plaintext,pn)) | 169 | if(!EVP_EncryptUpdate(&ctx,out,&outl,plaintext,pn)) |
158 | { | 170 | { |
159 | fprintf(stderr,"Encrypt failed\n"); | 171 | fprintf(stderr,"Encrypt failed\n"); |
160 | exit(6); | 172 | test1_exit(6); |
161 | } | 173 | } |
162 | if(!EVP_EncryptFinal_ex(&ctx,out+outl,&outl2)) | 174 | if(!EVP_EncryptFinal_ex(&ctx,out+outl,&outl2)) |
163 | { | 175 | { |
164 | fprintf(stderr,"EncryptFinal failed\n"); | 176 | fprintf(stderr,"EncryptFinal failed\n"); |
165 | exit(7); | 177 | test1_exit(7); |
166 | } | 178 | } |
167 | 179 | ||
168 | if(outl+outl2 != cn) | 180 | if(outl+outl2 != cn) |
169 | { | 181 | { |
170 | fprintf(stderr,"Ciphertext length mismatch got %d expected %d\n", | 182 | fprintf(stderr,"Ciphertext length mismatch got %d expected %d\n", |
171 | outl+outl2,cn); | 183 | outl+outl2,cn); |
172 | exit(8); | 184 | test1_exit(8); |
173 | } | 185 | } |
174 | 186 | ||
175 | if(memcmp(out,ciphertext,cn)) | 187 | if(memcmp(out,ciphertext,cn)) |
@@ -177,7 +189,7 @@ static void test1(const EVP_CIPHER *c,const unsigned char *key,int kn, | |||
177 | fprintf(stderr,"Ciphertext mismatch\n"); | 189 | fprintf(stderr,"Ciphertext mismatch\n"); |
178 | hexdump(stderr,"Got",out,cn); | 190 | hexdump(stderr,"Got",out,cn); |
179 | hexdump(stderr,"Expected",ciphertext,cn); | 191 | hexdump(stderr,"Expected",ciphertext,cn); |
180 | exit(9); | 192 | test1_exit(9); |
181 | } | 193 | } |
182 | } | 194 | } |
183 | 195 | ||
@@ -186,26 +198,26 @@ static void test1(const EVP_CIPHER *c,const unsigned char *key,int kn, | |||
186 | if(!EVP_DecryptInit_ex(&ctx,c,NULL,key,iv)) | 198 | if(!EVP_DecryptInit_ex(&ctx,c,NULL,key,iv)) |
187 | { | 199 | { |
188 | fprintf(stderr,"DecryptInit failed\n"); | 200 | fprintf(stderr,"DecryptInit failed\n"); |
189 | exit(11); | 201 | test1_exit(11); |
190 | } | 202 | } |
191 | EVP_CIPHER_CTX_set_padding(&ctx,0); | 203 | EVP_CIPHER_CTX_set_padding(&ctx,0); |
192 | 204 | ||
193 | if(!EVP_DecryptUpdate(&ctx,out,&outl,ciphertext,cn)) | 205 | if(!EVP_DecryptUpdate(&ctx,out,&outl,ciphertext,cn)) |
194 | { | 206 | { |
195 | fprintf(stderr,"Decrypt failed\n"); | 207 | fprintf(stderr,"Decrypt failed\n"); |
196 | exit(6); | 208 | test1_exit(6); |
197 | } | 209 | } |
198 | if(!EVP_DecryptFinal_ex(&ctx,out+outl,&outl2)) | 210 | if(!EVP_DecryptFinal_ex(&ctx,out+outl,&outl2)) |
199 | { | 211 | { |
200 | fprintf(stderr,"DecryptFinal failed\n"); | 212 | fprintf(stderr,"DecryptFinal failed\n"); |
201 | exit(7); | 213 | test1_exit(7); |
202 | } | 214 | } |
203 | 215 | ||
204 | if(outl+outl2 != cn) | 216 | if(outl+outl2 != cn) |
205 | { | 217 | { |
206 | fprintf(stderr,"Plaintext length mismatch got %d expected %d\n", | 218 | fprintf(stderr,"Plaintext length mismatch got %d expected %d\n", |
207 | outl+outl2,cn); | 219 | outl+outl2,cn); |
208 | exit(8); | 220 | test1_exit(8); |
209 | } | 221 | } |
210 | 222 | ||
211 | if(memcmp(out,plaintext,cn)) | 223 | if(memcmp(out,plaintext,cn)) |
@@ -213,7 +225,7 @@ static void test1(const EVP_CIPHER *c,const unsigned char *key,int kn, | |||
213 | fprintf(stderr,"Plaintext mismatch\n"); | 225 | fprintf(stderr,"Plaintext mismatch\n"); |
214 | hexdump(stderr,"Got",out,cn); | 226 | hexdump(stderr,"Got",out,cn); |
215 | hexdump(stderr,"Expected",plaintext,cn); | 227 | hexdump(stderr,"Expected",plaintext,cn); |
216 | exit(9); | 228 | test1_exit(9); |
217 | } | 229 | } |
218 | } | 230 | } |
219 | 231 | ||
@@ -260,24 +272,24 @@ static int test_digest(const char *digest, | |||
260 | if(!EVP_DigestInit_ex(&ctx,d, NULL)) | 272 | if(!EVP_DigestInit_ex(&ctx,d, NULL)) |
261 | { | 273 | { |
262 | fprintf(stderr,"DigestInit failed\n"); | 274 | fprintf(stderr,"DigestInit failed\n"); |
263 | exit(100); | 275 | EXIT(100); |
264 | } | 276 | } |
265 | if(!EVP_DigestUpdate(&ctx,plaintext,pn)) | 277 | if(!EVP_DigestUpdate(&ctx,plaintext,pn)) |
266 | { | 278 | { |
267 | fprintf(stderr,"DigestUpdate failed\n"); | 279 | fprintf(stderr,"DigestUpdate failed\n"); |
268 | exit(101); | 280 | EXIT(101); |
269 | } | 281 | } |
270 | if(!EVP_DigestFinal_ex(&ctx,md,&mdn)) | 282 | if(!EVP_DigestFinal_ex(&ctx,md,&mdn)) |
271 | { | 283 | { |
272 | fprintf(stderr,"DigestFinal failed\n"); | 284 | fprintf(stderr,"DigestFinal failed\n"); |
273 | exit(101); | 285 | EXIT(101); |
274 | } | 286 | } |
275 | EVP_MD_CTX_cleanup(&ctx); | 287 | EVP_MD_CTX_cleanup(&ctx); |
276 | 288 | ||
277 | if(mdn != cn) | 289 | if(mdn != cn) |
278 | { | 290 | { |
279 | fprintf(stderr,"Digest length mismatch, got %d expected %d\n",mdn,cn); | 291 | fprintf(stderr,"Digest length mismatch, got %d expected %d\n",mdn,cn); |
280 | exit(102); | 292 | EXIT(102); |
281 | } | 293 | } |
282 | 294 | ||
283 | if(memcmp(md,ciphertext,cn)) | 295 | if(memcmp(md,ciphertext,cn)) |
@@ -285,7 +297,7 @@ static int test_digest(const char *digest, | |||
285 | fprintf(stderr,"Digest mismatch\n"); | 297 | fprintf(stderr,"Digest mismatch\n"); |
286 | hexdump(stderr,"Got",md,cn); | 298 | hexdump(stderr,"Got",md,cn); |
287 | hexdump(stderr,"Expected",ciphertext,cn); | 299 | hexdump(stderr,"Expected",ciphertext,cn); |
288 | exit(103); | 300 | EXIT(103); |
289 | } | 301 | } |
290 | 302 | ||
291 | printf("\n"); | 303 | printf("\n"); |
@@ -303,7 +315,7 @@ int main(int argc,char **argv) | |||
303 | if(argc != 2) | 315 | if(argc != 2) |
304 | { | 316 | { |
305 | fprintf(stderr,"%s <test file>\n",argv[0]); | 317 | fprintf(stderr,"%s <test file>\n",argv[0]); |
306 | exit(1); | 318 | EXIT(1); |
307 | } | 319 | } |
308 | CRYPTO_malloc_debug_init(); | 320 | CRYPTO_malloc_debug_init(); |
309 | CRYPTO_set_mem_debug_options(V_CRYPTO_MDEBUG_ALL); | 321 | CRYPTO_set_mem_debug_options(V_CRYPTO_MDEBUG_ALL); |
@@ -315,17 +327,20 @@ int main(int argc,char **argv) | |||
315 | if(!f) | 327 | if(!f) |
316 | { | 328 | { |
317 | perror(szTestFile); | 329 | perror(szTestFile); |
318 | exit(2); | 330 | EXIT(2); |
319 | } | 331 | } |
320 | 332 | ||
321 | /* Load up the software EVP_CIPHER and EVP_MD definitions */ | 333 | /* Load up the software EVP_CIPHER and EVP_MD definitions */ |
322 | OpenSSL_add_all_ciphers(); | 334 | OpenSSL_add_all_ciphers(); |
323 | OpenSSL_add_all_digests(); | 335 | OpenSSL_add_all_digests(); |
336 | #ifndef OPENSSL_NO_ENGINE | ||
324 | /* Load all compiled-in ENGINEs */ | 337 | /* Load all compiled-in ENGINEs */ |
325 | ENGINE_load_builtin_engines(); | 338 | ENGINE_load_builtin_engines(); |
339 | #endif | ||
326 | #if 0 | 340 | #if 0 |
327 | OPENSSL_config(); | 341 | OPENSSL_config(); |
328 | #endif | 342 | #endif |
343 | #ifndef OPENSSL_NO_ENGINE | ||
329 | /* Register all available ENGINE implementations of ciphers and digests. | 344 | /* Register all available ENGINE implementations of ciphers and digests. |
330 | * This could perhaps be changed to "ENGINE_register_all_complete()"? */ | 345 | * This could perhaps be changed to "ENGINE_register_all_complete()"? */ |
331 | ENGINE_register_all_ciphers(); | 346 | ENGINE_register_all_ciphers(); |
@@ -334,6 +349,7 @@ int main(int argc,char **argv) | |||
334 | * It'll prevent ENGINEs being ENGINE_init()ialised for cipher/digest use if | 349 | * It'll prevent ENGINEs being ENGINE_init()ialised for cipher/digest use if |
335 | * they weren't already initialised. */ | 350 | * they weren't already initialised. */ |
336 | /* ENGINE_set_cipher_flags(ENGINE_CIPHER_FLAG_NOINIT); */ | 351 | /* ENGINE_set_cipher_flags(ENGINE_CIPHER_FLAG_NOINIT); */ |
352 | #endif | ||
337 | 353 | ||
338 | for( ; ; ) | 354 | for( ; ; ) |
339 | { | 355 | { |
@@ -371,11 +387,13 @@ int main(int argc,char **argv) | |||
371 | && !test_digest(cipher,plaintext,pn,ciphertext,cn)) | 387 | && !test_digest(cipher,plaintext,pn,ciphertext,cn)) |
372 | { | 388 | { |
373 | fprintf(stderr,"Can't find %s\n",cipher); | 389 | fprintf(stderr,"Can't find %s\n",cipher); |
374 | exit(3); | 390 | EXIT(3); |
375 | } | 391 | } |
376 | } | 392 | } |
377 | 393 | ||
394 | #ifndef OPENSSL_NO_ENGINE | ||
378 | ENGINE_cleanup(); | 395 | ENGINE_cleanup(); |
396 | #endif | ||
379 | EVP_cleanup(); | 397 | EVP_cleanup(); |
380 | CRYPTO_cleanup_all_ex_data(); | 398 | CRYPTO_cleanup_all_ex_data(); |
381 | ERR_remove_state(0); | 399 | ERR_remove_state(0); |
diff --git a/src/lib/libcrypto/hmac/hmactest.c b/src/lib/libcrypto/hmac/hmactest.c index 96d3beb8e6..1b906b81af 100644 --- a/src/lib/libcrypto/hmac/hmactest.c +++ b/src/lib/libcrypto/hmac/hmactest.c | |||
@@ -60,6 +60,8 @@ | |||
60 | #include <string.h> | 60 | #include <string.h> |
61 | #include <stdlib.h> | 61 | #include <stdlib.h> |
62 | 62 | ||
63 | #include "../e_os.h" | ||
64 | |||
63 | #ifdef OPENSSL_NO_HMAC | 65 | #ifdef OPENSSL_NO_HMAC |
64 | int main(int argc, char *argv[]) | 66 | int main(int argc, char *argv[]) |
65 | { | 67 | { |
@@ -68,12 +70,15 @@ int main(int argc, char *argv[]) | |||
68 | } | 70 | } |
69 | #else | 71 | #else |
70 | #include <openssl/hmac.h> | 72 | #include <openssl/hmac.h> |
73 | #ifndef OPENSSL_NO_MD5 | ||
71 | #include <openssl/md5.h> | 74 | #include <openssl/md5.h> |
75 | #endif | ||
72 | 76 | ||
73 | #ifdef CHARSET_EBCDIC | 77 | #ifdef CHARSET_EBCDIC |
74 | #include <openssl/ebcdic.h> | 78 | #include <openssl/ebcdic.h> |
75 | #endif | 79 | #endif |
76 | 80 | ||
81 | #ifndef OPENSSL_NO_MD5 | ||
77 | static struct test_st | 82 | static struct test_st |
78 | { | 83 | { |
79 | unsigned char key[16]; | 84 | unsigned char key[16]; |
@@ -113,13 +118,20 @@ static struct test_st | |||
113 | (unsigned char *)"56be34521d144c88dbb8c733f0e8b3f6", | 118 | (unsigned char *)"56be34521d144c88dbb8c733f0e8b3f6", |
114 | }, | 119 | }, |
115 | }; | 120 | }; |
116 | 121 | #endif | |
117 | 122 | ||
118 | static char *pt(unsigned char *md); | 123 | static char *pt(unsigned char *md); |
119 | int main(int argc, char *argv[]) | 124 | int main(int argc, char *argv[]) |
120 | { | 125 | { |
121 | int i,err=0; | 126 | #ifndef OPENSSL_NO_MD5 |
127 | int i; | ||
122 | char *p; | 128 | char *p; |
129 | #endif | ||
130 | int err=0; | ||
131 | |||
132 | #ifdef OPENSSL_NO_MD5 | ||
133 | printf("test skipped: MD5 disabled\n"); | ||
134 | #else | ||
123 | 135 | ||
124 | #ifdef CHARSET_EBCDIC | 136 | #ifdef CHARSET_EBCDIC |
125 | ebcdic2ascii(test[0].data, test[0].data, test[0].data_len); | 137 | ebcdic2ascii(test[0].data, test[0].data, test[0].data_len); |
@@ -144,10 +156,12 @@ int main(int argc, char *argv[]) | |||
144 | else | 156 | else |
145 | printf("test %d ok\n",i); | 157 | printf("test %d ok\n",i); |
146 | } | 158 | } |
147 | exit(err); | 159 | #endif /* OPENSSL_NO_MD5 */ |
160 | EXIT(err); | ||
148 | return(0); | 161 | return(0); |
149 | } | 162 | } |
150 | 163 | ||
164 | #ifndef OPENSSL_NO_MD5 | ||
151 | static char *pt(unsigned char *md) | 165 | static char *pt(unsigned char *md) |
152 | { | 166 | { |
153 | int i; | 167 | int i; |
@@ -158,3 +172,4 @@ static char *pt(unsigned char *md) | |||
158 | return(buf); | 172 | return(buf); |
159 | } | 173 | } |
160 | #endif | 174 | #endif |
175 | #endif | ||
diff --git a/src/lib/libcrypto/idea/version b/src/lib/libcrypto/idea/version new file mode 100644 index 0000000000..3f22293795 --- /dev/null +++ b/src/lib/libcrypto/idea/version | |||
@@ -0,0 +1,12 @@ | |||
1 | 1.1 07/12/95 - eay | ||
2 | Many thanks to Rhys Weatherley <rweather@us.oracle.com> | ||
3 | for pointing out that I was assuming little endian byte | ||
4 | order for all quantities what idea actually used | ||
5 | bigendian. No where in the spec does it mention | ||
6 | this, it is all in terms of 16 bit numbers and even the example | ||
7 | does not use byte streams for the input example :-(. | ||
8 | If you byte swap each pair of input, keys and iv, the functions | ||
9 | would produce the output as the old version :-(. | ||
10 | |||
11 | 1.0 ??/??/95 - eay | ||
12 | First version. | ||
diff --git a/src/lib/libcrypto/md2/md2_dgst.c b/src/lib/libcrypto/md2/md2_dgst.c index e25dd00e02..ecb64f0ec4 100644 --- a/src/lib/libcrypto/md2/md2_dgst.c +++ b/src/lib/libcrypto/md2/md2_dgst.c | |||
@@ -61,6 +61,7 @@ | |||
61 | #include <string.h> | 61 | #include <string.h> |
62 | #include <openssl/md2.h> | 62 | #include <openssl/md2.h> |
63 | #include <openssl/opensslv.h> | 63 | #include <openssl/opensslv.h> |
64 | #include <openssl/crypto.h> | ||
64 | 65 | ||
65 | const char *MD2_version="MD2" OPENSSL_VERSION_PTEXT; | 66 | const char *MD2_version="MD2" OPENSSL_VERSION_PTEXT; |
66 | 67 | ||
@@ -118,9 +119,9 @@ const char *MD2_options(void) | |||
118 | int MD2_Init(MD2_CTX *c) | 119 | int MD2_Init(MD2_CTX *c) |
119 | { | 120 | { |
120 | c->num=0; | 121 | c->num=0; |
121 | memset(c->state,0,MD2_BLOCK*sizeof(MD2_INT)); | 122 | memset(c->state,0,sizeof c->state); |
122 | memset(c->cksm,0,MD2_BLOCK*sizeof(MD2_INT)); | 123 | memset(c->cksm,0,sizeof c->cksm); |
123 | memset(c->data,0,MD2_BLOCK); | 124 | memset(c->data,0,sizeof c->data); |
124 | return 1; | 125 | return 1; |
125 | } | 126 | } |
126 | 127 | ||
@@ -196,7 +197,7 @@ static void md2_block(MD2_CTX *c, const unsigned char *d) | |||
196 | t=(t+i)&0xff; | 197 | t=(t+i)&0xff; |
197 | } | 198 | } |
198 | memcpy(sp1,state,16*sizeof(MD2_INT)); | 199 | memcpy(sp1,state,16*sizeof(MD2_INT)); |
199 | memset(state,0,48*sizeof(MD2_INT)); | 200 | OPENSSL_cleanse(state,48*sizeof(MD2_INT)); |
200 | } | 201 | } |
201 | 202 | ||
202 | int MD2_Final(unsigned char *md, MD2_CTX *c) | 203 | int MD2_Final(unsigned char *md, MD2_CTX *c) |
diff --git a/src/lib/libcrypto/md2/md2_one.c b/src/lib/libcrypto/md2/md2_one.c index b12c37ce4d..835160ef56 100644 --- a/src/lib/libcrypto/md2/md2_one.c +++ b/src/lib/libcrypto/md2/md2_one.c | |||
@@ -88,6 +88,6 @@ unsigned char *MD2(const unsigned char *d, unsigned long n, unsigned char *md) | |||
88 | } | 88 | } |
89 | #endif | 89 | #endif |
90 | MD2_Final(md,&c); | 90 | MD2_Final(md,&c); |
91 | memset(&c,0,sizeof(c)); /* Security consideration */ | 91 | OPENSSL_cleanse(&c,sizeof(c)); /* Security consideration */ |
92 | return(md); | 92 | return(md); |
93 | } | 93 | } |
diff --git a/src/lib/libcrypto/md2/md2test.c b/src/lib/libcrypto/md2/md2test.c index 7d3664faf5..901d0a7d8e 100644 --- a/src/lib/libcrypto/md2/md2test.c +++ b/src/lib/libcrypto/md2/md2test.c | |||
@@ -61,6 +61,8 @@ | |||
61 | #include <string.h> | 61 | #include <string.h> |
62 | #include <openssl/md2.h> | 62 | #include <openssl/md2.h> |
63 | 63 | ||
64 | #include "../e_os.h" | ||
65 | |||
64 | #ifdef OPENSSL_NO_MD2 | 66 | #ifdef OPENSSL_NO_MD2 |
65 | int main(int argc, char *argv[]) | 67 | int main(int argc, char *argv[]) |
66 | { | 68 | { |
@@ -122,8 +124,7 @@ int main(int argc, char *argv[]) | |||
122 | R++; | 124 | R++; |
123 | P++; | 125 | P++; |
124 | } | 126 | } |
125 | exit(err); | 127 | EXIT(err); |
126 | return(0); | ||
127 | } | 128 | } |
128 | 129 | ||
129 | static char *pt(unsigned char *md) | 130 | static char *pt(unsigned char *md) |
diff --git a/src/lib/libcrypto/md4/md4.c b/src/lib/libcrypto/md4/md4.c index e4b0aac011..141415ad4d 100644 --- a/src/lib/libcrypto/md4/md4.c +++ b/src/lib/libcrypto/md4/md4.c | |||
@@ -64,7 +64,7 @@ | |||
64 | 64 | ||
65 | void do_fp(FILE *f); | 65 | void do_fp(FILE *f); |
66 | void pt(unsigned char *md); | 66 | void pt(unsigned char *md); |
67 | #ifndef _OSD_POSIX | 67 | #if !defined(_OSD_POSIX) && !defined(__DJGPP__) |
68 | int read(int, void *, unsigned int); | 68 | int read(int, void *, unsigned int); |
69 | #endif | 69 | #endif |
70 | 70 | ||
@@ -108,7 +108,7 @@ void do_fp(FILE *f) | |||
108 | MD4_Init(&c); | 108 | MD4_Init(&c); |
109 | for (;;) | 109 | for (;;) |
110 | { | 110 | { |
111 | i=read(fd,buf,BUFSIZE); | 111 | i=read(fd,buf,sizeof buf); |
112 | if (i <= 0) break; | 112 | if (i <= 0) break; |
113 | MD4_Update(&c,buf,(unsigned long)i); | 113 | MD4_Update(&c,buf,(unsigned long)i); |
114 | } | 114 | } |
diff --git a/src/lib/libcrypto/md4/md4test.c b/src/lib/libcrypto/md4/md4test.c index e0fdc42282..21a77d96f7 100644 --- a/src/lib/libcrypto/md4/md4test.c +++ b/src/lib/libcrypto/md4/md4test.c | |||
@@ -60,6 +60,8 @@ | |||
60 | #include <string.h> | 60 | #include <string.h> |
61 | #include <stdlib.h> | 61 | #include <stdlib.h> |
62 | 62 | ||
63 | #include "../e_os.h" | ||
64 | |||
63 | #ifdef OPENSSL_NO_MD4 | 65 | #ifdef OPENSSL_NO_MD4 |
64 | int main(int argc, char *argv[]) | 66 | int main(int argc, char *argv[]) |
65 | { | 67 | { |
@@ -118,7 +120,7 @@ int main(int argc, char *argv[]) | |||
118 | R++; | 120 | R++; |
119 | P++; | 121 | P++; |
120 | } | 122 | } |
121 | exit(err); | 123 | EXIT(err); |
122 | return(0); | 124 | return(0); |
123 | } | 125 | } |
124 | 126 | ||
diff --git a/src/lib/libcrypto/md5/md5.c b/src/lib/libcrypto/md5/md5.c index 7ed0024ae1..563733abc5 100644 --- a/src/lib/libcrypto/md5/md5.c +++ b/src/lib/libcrypto/md5/md5.c | |||
@@ -64,7 +64,7 @@ | |||
64 | 64 | ||
65 | void do_fp(FILE *f); | 65 | void do_fp(FILE *f); |
66 | void pt(unsigned char *md); | 66 | void pt(unsigned char *md); |
67 | #ifndef _OSD_POSIX | 67 | #if !defined(_OSD_POSIX) && !defined(__DJGPP__) |
68 | int read(int, void *, unsigned int); | 68 | int read(int, void *, unsigned int); |
69 | #endif | 69 | #endif |
70 | 70 | ||
diff --git a/src/lib/libcrypto/md5/md5test.c b/src/lib/libcrypto/md5/md5test.c index 862b89658a..bfd62629ed 100644 --- a/src/lib/libcrypto/md5/md5test.c +++ b/src/lib/libcrypto/md5/md5test.c | |||
@@ -60,6 +60,8 @@ | |||
60 | #include <string.h> | 60 | #include <string.h> |
61 | #include <stdlib.h> | 61 | #include <stdlib.h> |
62 | 62 | ||
63 | #include "../e_os.h" | ||
64 | |||
63 | #ifdef OPENSSL_NO_MD5 | 65 | #ifdef OPENSSL_NO_MD5 |
64 | int main(int argc, char *argv[]) | 66 | int main(int argc, char *argv[]) |
65 | { | 67 | { |
@@ -118,7 +120,7 @@ int main(int argc, char *argv[]) | |||
118 | R++; | 120 | R++; |
119 | P++; | 121 | P++; |
120 | } | 122 | } |
121 | exit(err); | 123 | EXIT(err); |
122 | return(0); | 124 | return(0); |
123 | } | 125 | } |
124 | 126 | ||
diff --git a/src/lib/libcrypto/mdc2/mdc2test.c b/src/lib/libcrypto/mdc2/mdc2test.c new file mode 100644 index 0000000000..c9abe99d92 --- /dev/null +++ b/src/lib/libcrypto/mdc2/mdc2test.c | |||
@@ -0,0 +1,146 @@ | |||
1 | /* crypto/mdc2/mdc2test.c */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #include <stdio.h> | ||
60 | #include <stdlib.h> | ||
61 | #include <string.h> | ||
62 | |||
63 | #include "../e_os.h" | ||
64 | |||
65 | #if defined(OPENSSL_NO_DES) && !defined(OPENSSL_NO_MDC2) | ||
66 | #define OPENSSL_NO_MDC2 | ||
67 | #endif | ||
68 | |||
69 | #ifdef OPENSSL_NO_MDC2 | ||
70 | int main(int argc, char *argv[]) | ||
71 | { | ||
72 | printf("No MDC2 support\n"); | ||
73 | return(0); | ||
74 | } | ||
75 | #else | ||
76 | #include <openssl/evp.h> | ||
77 | #include <openssl/mdc2.h> | ||
78 | |||
79 | #ifdef CHARSET_EBCDIC | ||
80 | #include <openssl/ebcdic.h> | ||
81 | #endif | ||
82 | |||
83 | static unsigned char pad1[16]={ | ||
84 | 0x42,0xE5,0x0C,0xD2,0x24,0xBA,0xCE,0xBA, | ||
85 | 0x76,0x0B,0xDD,0x2B,0xD4,0x09,0x28,0x1A | ||
86 | }; | ||
87 | |||
88 | static unsigned char pad2[16]={ | ||
89 | 0x2E,0x46,0x79,0xB5,0xAD,0xD9,0xCA,0x75, | ||
90 | 0x35,0xD8,0x7A,0xFE,0xAB,0x33,0xBE,0xE2 | ||
91 | }; | ||
92 | |||
93 | int main(int argc, char *argv[]) | ||
94 | { | ||
95 | int ret=0; | ||
96 | unsigned char md[MDC2_DIGEST_LENGTH]; | ||
97 | int i; | ||
98 | EVP_MD_CTX c; | ||
99 | static char *text="Now is the time for all "; | ||
100 | |||
101 | #ifdef CHARSET_EBCDIC | ||
102 | ebcdic2ascii(text,text,strlen(text)); | ||
103 | #endif | ||
104 | |||
105 | EVP_MD_CTX_init(&c); | ||
106 | EVP_DigestInit_ex(&c,EVP_mdc2(), NULL); | ||
107 | EVP_DigestUpdate(&c,(unsigned char *)text,strlen(text)); | ||
108 | EVP_DigestFinal_ex(&c,&(md[0]),NULL); | ||
109 | |||
110 | if (memcmp(md,pad1,MDC2_DIGEST_LENGTH) != 0) | ||
111 | { | ||
112 | for (i=0; i<MDC2_DIGEST_LENGTH; i++) | ||
113 | printf("%02X",md[i]); | ||
114 | printf(" <- generated\n"); | ||
115 | for (i=0; i<MDC2_DIGEST_LENGTH; i++) | ||
116 | printf("%02X",pad1[i]); | ||
117 | printf(" <- correct\n"); | ||
118 | ret=1; | ||
119 | } | ||
120 | else | ||
121 | printf("pad1 - ok\n"); | ||
122 | |||
123 | EVP_DigestInit_ex(&c,EVP_mdc2(), NULL); | ||
124 | /* FIXME: use a ctl function? */ | ||
125 | ((MDC2_CTX *)c.md_data)->pad_type=2; | ||
126 | EVP_DigestUpdate(&c,(unsigned char *)text,strlen(text)); | ||
127 | EVP_DigestFinal_ex(&c,&(md[0]),NULL); | ||
128 | |||
129 | if (memcmp(md,pad2,MDC2_DIGEST_LENGTH) != 0) | ||
130 | { | ||
131 | for (i=0; i<MDC2_DIGEST_LENGTH; i++) | ||
132 | printf("%02X",md[i]); | ||
133 | printf(" <- generated\n"); | ||
134 | for (i=0; i<MDC2_DIGEST_LENGTH; i++) | ||
135 | printf("%02X",pad2[i]); | ||
136 | printf(" <- correct\n"); | ||
137 | ret=1; | ||
138 | } | ||
139 | else | ||
140 | printf("pad2 - ok\n"); | ||
141 | |||
142 | EVP_MD_CTX_cleanup(&c); | ||
143 | EXIT(ret); | ||
144 | return(ret); | ||
145 | } | ||
146 | #endif | ||
diff --git a/src/lib/libcrypto/mem.c b/src/lib/libcrypto/mem.c index a7826908e6..29df7d35b2 100644 --- a/src/lib/libcrypto/mem.c +++ b/src/lib/libcrypto/mem.c | |||
@@ -250,6 +250,9 @@ void CRYPTO_get_mem_debug_functions(void (**m)(void *,int,const char *,int,int), | |||
250 | void *CRYPTO_malloc_locked(int num, const char *file, int line) | 250 | void *CRYPTO_malloc_locked(int num, const char *file, int line) |
251 | { | 251 | { |
252 | void *ret = NULL; | 252 | void *ret = NULL; |
253 | extern unsigned char cleanse_ctr; | ||
254 | |||
255 | if (num < 0) return NULL; | ||
253 | 256 | ||
254 | allow_customize = 0; | 257 | allow_customize = 0; |
255 | if (malloc_debug_func != NULL) | 258 | if (malloc_debug_func != NULL) |
@@ -264,6 +267,12 @@ void *CRYPTO_malloc_locked(int num, const char *file, int line) | |||
264 | if (malloc_debug_func != NULL) | 267 | if (malloc_debug_func != NULL) |
265 | malloc_debug_func(ret, num, file, line, 1); | 268 | malloc_debug_func(ret, num, file, line, 1); |
266 | 269 | ||
270 | /* Create a dependency on the value of 'cleanse_ctr' so our memory | ||
271 | * sanitisation function can't be optimised out. NB: We only do | ||
272 | * this for >2Kb so the overhead doesn't bother us. */ | ||
273 | if(ret && (num > 2048)) | ||
274 | ((unsigned char *)ret)[0] = cleanse_ctr; | ||
275 | |||
267 | return ret; | 276 | return ret; |
268 | } | 277 | } |
269 | 278 | ||
@@ -282,6 +291,9 @@ void CRYPTO_free_locked(void *str) | |||
282 | void *CRYPTO_malloc(int num, const char *file, int line) | 291 | void *CRYPTO_malloc(int num, const char *file, int line) |
283 | { | 292 | { |
284 | void *ret = NULL; | 293 | void *ret = NULL; |
294 | extern unsigned char cleanse_ctr; | ||
295 | |||
296 | if (num < 0) return NULL; | ||
285 | 297 | ||
286 | allow_customize = 0; | 298 | allow_customize = 0; |
287 | if (malloc_debug_func != NULL) | 299 | if (malloc_debug_func != NULL) |
@@ -296,6 +308,12 @@ void *CRYPTO_malloc(int num, const char *file, int line) | |||
296 | if (malloc_debug_func != NULL) | 308 | if (malloc_debug_func != NULL) |
297 | malloc_debug_func(ret, num, file, line, 1); | 309 | malloc_debug_func(ret, num, file, line, 1); |
298 | 310 | ||
311 | /* Create a dependency on the value of 'cleanse_ctr' so our memory | ||
312 | * sanitisation function can't be optimised out. NB: We only do | ||
313 | * this for >2Kb so the overhead doesn't bother us. */ | ||
314 | if(ret && (num > 2048)) | ||
315 | ((unsigned char *)ret)[0] = cleanse_ctr; | ||
316 | |||
299 | return ret; | 317 | return ret; |
300 | } | 318 | } |
301 | 319 | ||
@@ -306,6 +324,8 @@ void *CRYPTO_realloc(void *str, int num, const char *file, int line) | |||
306 | if (str == NULL) | 324 | if (str == NULL) |
307 | return CRYPTO_malloc(num, file, line); | 325 | return CRYPTO_malloc(num, file, line); |
308 | 326 | ||
327 | if (num < 0) return NULL; | ||
328 | |||
309 | if (realloc_debug_func != NULL) | 329 | if (realloc_debug_func != NULL) |
310 | realloc_debug_func(str, NULL, num, file, line, 0); | 330 | realloc_debug_func(str, NULL, num, file, line, 0); |
311 | ret = realloc_ex_func(str,num,file,line); | 331 | ret = realloc_ex_func(str,num,file,line); |
@@ -318,6 +338,32 @@ void *CRYPTO_realloc(void *str, int num, const char *file, int line) | |||
318 | return ret; | 338 | return ret; |
319 | } | 339 | } |
320 | 340 | ||
341 | void *CRYPTO_realloc_clean(void *str, int old_len, int num, const char *file, | ||
342 | int line) | ||
343 | { | ||
344 | void *ret = NULL; | ||
345 | |||
346 | if (str == NULL) | ||
347 | return CRYPTO_malloc(num, file, line); | ||
348 | |||
349 | if (num < 0) return NULL; | ||
350 | |||
351 | if (realloc_debug_func != NULL) | ||
352 | realloc_debug_func(str, NULL, num, file, line, 0); | ||
353 | ret=malloc_ex_func(num,file,line); | ||
354 | if(ret) | ||
355 | memcpy(ret,str,old_len); | ||
356 | OPENSSL_cleanse(str,old_len); | ||
357 | free_func(str); | ||
358 | #ifdef LEVITTE_DEBUG_MEM | ||
359 | fprintf(stderr, "LEVITTE_DEBUG_MEM: | 0x%p -> 0x%p (%d)\n", str, ret, num); | ||
360 | #endif | ||
361 | if (realloc_debug_func != NULL) | ||
362 | realloc_debug_func(str, ret, num, file, line, 1); | ||
363 | |||
364 | return ret; | ||
365 | } | ||
366 | |||
321 | void CRYPTO_free(void *str) | 367 | void CRYPTO_free(void *str) |
322 | { | 368 | { |
323 | if (free_debug_func != NULL) | 369 | if (free_debug_func != NULL) |
@@ -337,7 +383,6 @@ void *CRYPTO_remalloc(void *a, int num, const char *file, int line) | |||
337 | return(a); | 383 | return(a); |
338 | } | 384 | } |
339 | 385 | ||
340 | |||
341 | void CRYPTO_set_mem_debug_options(long bits) | 386 | void CRYPTO_set_mem_debug_options(long bits) |
342 | { | 387 | { |
343 | if (set_debug_options_func != NULL) | 388 | if (set_debug_options_func != NULL) |
diff --git a/src/lib/libcrypto/objects/obj_dat.h b/src/lib/libcrypto/objects/obj_dat.h index 30812c8aa6..969b18a341 100644 --- a/src/lib/libcrypto/objects/obj_dat.h +++ b/src/lib/libcrypto/objects/obj_dat.h | |||
@@ -62,12 +62,12 @@ | |||
62 | * [including the GNU Public Licence.] | 62 | * [including the GNU Public Licence.] |
63 | */ | 63 | */ |
64 | 64 | ||
65 | #define NUM_NID 645 | 65 | #define NUM_NID 650 |
66 | #define NUM_SN 641 | 66 | #define NUM_SN 643 |
67 | #define NUM_LN 641 | 67 | #define NUM_LN 643 |
68 | #define NUM_OBJ 615 | 68 | #define NUM_OBJ 617 |
69 | 69 | ||
70 | static unsigned char lvalues[4435]={ | 70 | static unsigned char lvalues[4455]={ |
71 | 0x00, /* [ 0] OBJ_undef */ | 71 | 0x00, /* [ 0] OBJ_undef */ |
72 | 0x2A,0x86,0x48,0x86,0xF7,0x0D, /* [ 1] OBJ_rsadsi */ | 72 | 0x2A,0x86,0x48,0x86,0xF7,0x0D, /* [ 1] OBJ_rsadsi */ |
73 | 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01, /* [ 7] OBJ_pkcs */ | 73 | 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01, /* [ 7] OBJ_pkcs */ |
@@ -683,6 +683,8 @@ static unsigned char lvalues[4435]={ | |||
683 | 0x67,0x2A,0x08,0xAE,0x7B, /* [4412] OBJ_set_brand_Novus */ | 683 | 0x67,0x2A,0x08,0xAE,0x7B, /* [4412] OBJ_set_brand_Novus */ |
684 | 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x03,0x0A, /* [4417] OBJ_des_cdmf */ | 684 | 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x03,0x0A, /* [4417] OBJ_des_cdmf */ |
685 | 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x06,/* [4425] OBJ_rsaOAEPEncryptionSET */ | 685 | 0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x06,/* [4425] OBJ_rsaOAEPEncryptionSET */ |
686 | 0x2B,0x06,0x01,0x04,0x01,0x82,0x37,0x14,0x02,0x02,/* [4434] OBJ_ms_smartcard_login */ | ||
687 | 0x2B,0x06,0x01,0x04,0x01,0x82,0x37,0x14,0x02,0x03,/* [4444] OBJ_ms_upn */ | ||
686 | }; | 688 | }; |
687 | 689 | ||
688 | static ASN1_OBJECT nid_objs[NUM_NID]={ | 690 | static ASN1_OBJECT nid_objs[NUM_NID]={ |
@@ -824,7 +826,7 @@ static ASN1_OBJECT nid_objs[NUM_NID]={ | |||
824 | {"RSA-MDC2","mdc2WithRSA",NID_mdc2WithRSA,4,&(lvalues[531]),0}, | 826 | {"RSA-MDC2","mdc2WithRSA",NID_mdc2WithRSA,4,&(lvalues[531]),0}, |
825 | {"RC4-40","rc4-40",NID_rc4_40,0,NULL}, | 827 | {"RC4-40","rc4-40",NID_rc4_40,0,NULL}, |
826 | {"RC2-40-CBC","rc2-40-cbc",NID_rc2_40_cbc,0,NULL}, | 828 | {"RC2-40-CBC","rc2-40-cbc",NID_rc2_40_cbc,0,NULL}, |
827 | {"gn","givenName",NID_givenName,3,&(lvalues[535]),0}, | 829 | {"GN","givenName",NID_givenName,3,&(lvalues[535]),0}, |
828 | {"SN","surname",NID_surname,3,&(lvalues[538]),0}, | 830 | {"SN","surname",NID_surname,3,&(lvalues[538]),0}, |
829 | {"initials","initials",NID_initials,3,&(lvalues[541]),0}, | 831 | {"initials","initials",NID_initials,3,&(lvalues[541]),0}, |
830 | {NULL,NULL,NID_undef,0,NULL}, | 832 | {NULL,NULL,NID_undef,0,NULL}, |
@@ -1719,6 +1721,13 @@ static ASN1_OBJECT nid_objs[NUM_NID]={ | |||
1719 | {"DES-CDMF","des-cdmf",NID_des_cdmf,8,&(lvalues[4417]),0}, | 1721 | {"DES-CDMF","des-cdmf",NID_des_cdmf,8,&(lvalues[4417]),0}, |
1720 | {"rsaOAEPEncryptionSET","rsaOAEPEncryptionSET", | 1722 | {"rsaOAEPEncryptionSET","rsaOAEPEncryptionSET", |
1721 | NID_rsaOAEPEncryptionSET,9,&(lvalues[4425]),0}, | 1723 | NID_rsaOAEPEncryptionSET,9,&(lvalues[4425]),0}, |
1724 | {NULL,NULL,NID_undef,0,NULL}, | ||
1725 | {NULL,NULL,NID_undef,0,NULL}, | ||
1726 | {NULL,NULL,NID_undef,0,NULL}, | ||
1727 | {"msSmartcardLogin","Microsoft Smartcardlogin",NID_ms_smartcard_login, | ||
1728 | 10,&(lvalues[4434]),0}, | ||
1729 | {"msUPN","Microsoft Universal Principal Name",NID_ms_upn,10, | ||
1730 | &(lvalues[4444]),0}, | ||
1722 | }; | 1731 | }; |
1723 | 1732 | ||
1724 | static ASN1_OBJECT *sn_objs[NUM_SN]={ | 1733 | static ASN1_OBJECT *sn_objs[NUM_SN]={ |
@@ -1771,6 +1780,7 @@ static ASN1_OBJECT *sn_objs[NUM_SN]={ | |||
1771 | &(nid_objs[70]),/* "DSA-SHA1-old" */ | 1780 | &(nid_objs[70]),/* "DSA-SHA1-old" */ |
1772 | &(nid_objs[67]),/* "DSA-old" */ | 1781 | &(nid_objs[67]),/* "DSA-old" */ |
1773 | &(nid_objs[297]),/* "DVCS" */ | 1782 | &(nid_objs[297]),/* "DVCS" */ |
1783 | &(nid_objs[99]),/* "GN" */ | ||
1774 | &(nid_objs[381]),/* "IANA" */ | 1784 | &(nid_objs[381]),/* "IANA" */ |
1775 | &(nid_objs[34]),/* "IDEA-CBC" */ | 1785 | &(nid_objs[34]),/* "IDEA-CBC" */ |
1776 | &(nid_objs[35]),/* "IDEA-CFB" */ | 1786 | &(nid_objs[35]),/* "IDEA-CFB" */ |
@@ -1917,7 +1927,6 @@ static ASN1_OBJECT *sn_objs[NUM_SN]={ | |||
1917 | &(nid_objs[490]),/* "friendlyCountryName" */ | 1927 | &(nid_objs[490]),/* "friendlyCountryName" */ |
1918 | &(nid_objs[156]),/* "friendlyName" */ | 1928 | &(nid_objs[156]),/* "friendlyName" */ |
1919 | &(nid_objs[509]),/* "generationQualifier" */ | 1929 | &(nid_objs[509]),/* "generationQualifier" */ |
1920 | &(nid_objs[99]),/* "gn" */ | ||
1921 | &(nid_objs[163]),/* "hmacWithSHA1" */ | 1930 | &(nid_objs[163]),/* "hmacWithSHA1" */ |
1922 | &(nid_objs[432]),/* "holdInstructionCallIssuer" */ | 1931 | &(nid_objs[432]),/* "holdInstructionCallIssuer" */ |
1923 | &(nid_objs[430]),/* "holdInstructionCode" */ | 1932 | &(nid_objs[430]),/* "holdInstructionCode" */ |
@@ -2127,6 +2136,8 @@ static ASN1_OBJECT *sn_objs[NUM_SN]={ | |||
2127 | &(nid_objs[138]),/* "msEFS" */ | 2136 | &(nid_objs[138]),/* "msEFS" */ |
2128 | &(nid_objs[171]),/* "msExtReq" */ | 2137 | &(nid_objs[171]),/* "msExtReq" */ |
2129 | &(nid_objs[137]),/* "msSGC" */ | 2138 | &(nid_objs[137]),/* "msSGC" */ |
2139 | &(nid_objs[648]),/* "msSmartcardLogin" */ | ||
2140 | &(nid_objs[649]),/* "msUPN" */ | ||
2130 | &(nid_objs[481]),/* "nSRecord" */ | 2141 | &(nid_objs[481]),/* "nSRecord" */ |
2131 | &(nid_objs[173]),/* "name" */ | 2142 | &(nid_objs[173]),/* "name" */ |
2132 | &(nid_objs[369]),/* "noCheck" */ | 2143 | &(nid_objs[369]),/* "noCheck" */ |
@@ -2401,7 +2412,9 @@ static ASN1_OBJECT *ln_objs[NUM_LN]={ | |||
2401 | &(nid_objs[171]),/* "Microsoft Extension Request" */ | 2412 | &(nid_objs[171]),/* "Microsoft Extension Request" */ |
2402 | &(nid_objs[134]),/* "Microsoft Individual Code Signing" */ | 2413 | &(nid_objs[134]),/* "Microsoft Individual Code Signing" */ |
2403 | &(nid_objs[137]),/* "Microsoft Server Gated Crypto" */ | 2414 | &(nid_objs[137]),/* "Microsoft Server Gated Crypto" */ |
2415 | &(nid_objs[648]),/* "Microsoft Smartcardlogin" */ | ||
2404 | &(nid_objs[136]),/* "Microsoft Trust List Signing" */ | 2416 | &(nid_objs[136]),/* "Microsoft Trust List Signing" */ |
2417 | &(nid_objs[649]),/* "Microsoft Universal Principal Name" */ | ||
2405 | &(nid_objs[72]),/* "Netscape Base Url" */ | 2418 | &(nid_objs[72]),/* "Netscape Base Url" */ |
2406 | &(nid_objs[76]),/* "Netscape CA Policy Url" */ | 2419 | &(nid_objs[76]),/* "Netscape CA Policy Url" */ |
2407 | &(nid_objs[74]),/* "Netscape CA Revocation Url" */ | 2420 | &(nid_objs[74]),/* "Netscape CA Revocation Url" */ |
@@ -3557,6 +3570,8 @@ static ASN1_OBJECT *obj_objs[NUM_OBJ]={ | |||
3557 | &(nid_objs[136]),/* OBJ_ms_ctl_sign 1 3 6 1 4 1 311 10 3 1 */ | 3570 | &(nid_objs[136]),/* OBJ_ms_ctl_sign 1 3 6 1 4 1 311 10 3 1 */ |
3558 | &(nid_objs[137]),/* OBJ_ms_sgc 1 3 6 1 4 1 311 10 3 3 */ | 3571 | &(nid_objs[137]),/* OBJ_ms_sgc 1 3 6 1 4 1 311 10 3 3 */ |
3559 | &(nid_objs[138]),/* OBJ_ms_efs 1 3 6 1 4 1 311 10 3 4 */ | 3572 | &(nid_objs[138]),/* OBJ_ms_efs 1 3 6 1 4 1 311 10 3 4 */ |
3573 | &(nid_objs[648]),/* OBJ_ms_smartcard_login 1 3 6 1 4 1 311 20 2 2 */ | ||
3574 | &(nid_objs[649]),/* OBJ_ms_upn 1 3 6 1 4 1 311 20 2 3 */ | ||
3560 | &(nid_objs[196]),/* OBJ_id_smime_mod_cms 1 2 840 113549 1 9 16 0 1 */ | 3575 | &(nid_objs[196]),/* OBJ_id_smime_mod_cms 1 2 840 113549 1 9 16 0 1 */ |
3561 | &(nid_objs[197]),/* OBJ_id_smime_mod_ess 1 2 840 113549 1 9 16 0 2 */ | 3576 | &(nid_objs[197]),/* OBJ_id_smime_mod_ess 1 2 840 113549 1 9 16 0 2 */ |
3562 | &(nid_objs[198]),/* OBJ_id_smime_mod_oid 1 2 840 113549 1 9 16 0 3 */ | 3577 | &(nid_objs[198]),/* OBJ_id_smime_mod_oid 1 2 840 113549 1 9 16 0 3 */ |
diff --git a/src/lib/libcrypto/objects/obj_mac.h b/src/lib/libcrypto/objects/obj_mac.h index 899db8325c..7645012298 100644 --- a/src/lib/libcrypto/objects/obj_mac.h +++ b/src/lib/libcrypto/objects/obj_mac.h | |||
@@ -850,6 +850,16 @@ | |||
850 | #define NID_ms_efs 138 | 850 | #define NID_ms_efs 138 |
851 | #define OBJ_ms_efs 1L,3L,6L,1L,4L,1L,311L,10L,3L,4L | 851 | #define OBJ_ms_efs 1L,3L,6L,1L,4L,1L,311L,10L,3L,4L |
852 | 852 | ||
853 | #define SN_ms_smartcard_login "msSmartcardLogin" | ||
854 | #define LN_ms_smartcard_login "Microsoft Smartcardlogin" | ||
855 | #define NID_ms_smartcard_login 648 | ||
856 | #define OBJ_ms_smartcard_login 1L,3L,6L,1L,4L,1L,311L,20L,2L,2L | ||
857 | |||
858 | #define SN_ms_upn "msUPN" | ||
859 | #define LN_ms_upn "Microsoft Universal Principal Name" | ||
860 | #define NID_ms_upn 649 | ||
861 | #define OBJ_ms_upn 1L,3L,6L,1L,4L,1L,311L,20L,2L,3L | ||
862 | |||
853 | #define SN_idea_cbc "IDEA-CBC" | 863 | #define SN_idea_cbc "IDEA-CBC" |
854 | #define LN_idea_cbc "idea-cbc" | 864 | #define LN_idea_cbc "idea-cbc" |
855 | #define NID_idea_cbc 34 | 865 | #define NID_idea_cbc 34 |
@@ -1632,7 +1642,7 @@ | |||
1632 | #define NID_name 173 | 1642 | #define NID_name 173 |
1633 | #define OBJ_name OBJ_X509,41L | 1643 | #define OBJ_name OBJ_X509,41L |
1634 | 1644 | ||
1635 | #define SN_givenName "gn" | 1645 | #define SN_givenName "GN" |
1636 | #define LN_givenName "givenName" | 1646 | #define LN_givenName "givenName" |
1637 | #define NID_givenName 99 | 1647 | #define NID_givenName 99 |
1638 | #define OBJ_givenName OBJ_X509,42L | 1648 | #define OBJ_givenName OBJ_X509,42L |
diff --git a/src/lib/libcrypto/opensslconf.h b/src/lib/libcrypto/opensslconf.h index c9756e47a3..492041bc7c 100644 --- a/src/lib/libcrypto/opensslconf.h +++ b/src/lib/libcrypto/opensslconf.h | |||
@@ -69,7 +69,7 @@ | |||
69 | #endif | 69 | #endif |
70 | #endif | 70 | #endif |
71 | 71 | ||
72 | #if (defined(HEADER_DES_H) || defined(HEADER_DES_OLD_H)) && !defined(DES_LONG) | 72 | #if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG) |
73 | /* If this is set to 'unsigned int' on a DEC Alpha, this gives about a | 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). */ | 74 | * %20 speed up (longs are 8 bytes, int's are 4). */ |
75 | #ifndef DES_LONG | 75 | #ifndef DES_LONG |
diff --git a/src/lib/libcrypto/opensslconf.h.in b/src/lib/libcrypto/opensslconf.h.in index 9082a16c46..685e83b7a3 100644 --- a/src/lib/libcrypto/opensslconf.h.in +++ b/src/lib/libcrypto/opensslconf.h.in | |||
@@ -47,7 +47,7 @@ | |||
47 | #endif | 47 | #endif |
48 | #endif | 48 | #endif |
49 | 49 | ||
50 | #if (defined(HEADER_DES_H) || defined(HEADER_DES_OLD_H)) && !defined(DES_LONG) | 50 | #if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG) |
51 | /* If this is set to 'unsigned int' on a DEC Alpha, this gives about a | 51 | /* If this is set to 'unsigned int' on a DEC Alpha, this gives about a |
52 | * %20 speed up (longs are 8 bytes, int's are 4). */ | 52 | * %20 speed up (longs are 8 bytes, int's are 4). */ |
53 | #ifndef DES_LONG | 53 | #ifndef DES_LONG |
diff --git a/src/lib/libcrypto/perlasm/x86ms.pl b/src/lib/libcrypto/perlasm/x86ms.pl index 206452341d..35f1a4ddb9 100644 --- a/src/lib/libcrypto/perlasm/x86ms.pl +++ b/src/lib/libcrypto/perlasm/x86ms.pl | |||
@@ -92,6 +92,8 @@ sub get_mem | |||
92 | $addr="_$addr"; | 92 | $addr="_$addr"; |
93 | } | 93 | } |
94 | 94 | ||
95 | if ($addr =~ /^.+\-.+$/) { $addr="($addr)"; } | ||
96 | |||
95 | $reg1="$regs{$reg1}" if defined($regs{$reg1}); | 97 | $reg1="$regs{$reg1}" if defined($regs{$reg1}); |
96 | $reg2="$regs{$reg2}" if defined($regs{$reg2}); | 98 | $reg2="$regs{$reg2}" if defined($regs{$reg2}); |
97 | if (($addr ne "") && ($addr ne 0)) | 99 | if (($addr ne "") && ($addr ne 0)) |
@@ -111,6 +113,7 @@ sub get_mem | |||
111 | { | 113 | { |
112 | $ret.="[$reg1$post]" | 114 | $ret.="[$reg1$post]" |
113 | } | 115 | } |
116 | $ret =~ s/\[\]//; # in case $addr was the only argument | ||
114 | return($ret); | 117 | return($ret); |
115 | } | 118 | } |
116 | 119 | ||
@@ -151,7 +154,7 @@ sub main'push { &out1("push",@_); $stack+=4; } | |||
151 | sub main'pop { &out1("pop",@_); $stack-=4; } | 154 | sub main'pop { &out1("pop",@_); $stack-=4; } |
152 | sub main'bswap { &out1("bswap",@_); &using486(); } | 155 | sub main'bswap { &out1("bswap",@_); &using486(); } |
153 | sub main'not { &out1("not",@_); } | 156 | sub main'not { &out1("not",@_); } |
154 | sub main'call { &out1("call",'_'.$_[0]); } | 157 | sub main'call { &out1("call",($_[0]=~/^\$L/?'':'_').$_[0]); } |
155 | sub main'ret { &out0("ret"); } | 158 | sub main'ret { &out0("ret"); } |
156 | sub main'nop { &out0("nop"); } | 159 | sub main'nop { &out0("nop"); } |
157 | 160 | ||
@@ -338,7 +341,7 @@ sub main'set_label | |||
338 | { | 341 | { |
339 | if (!defined($label{$_[0]})) | 342 | if (!defined($label{$_[0]})) |
340 | { | 343 | { |
341 | $label{$_[0]}="${label}${_[0]}"; | 344 | $label{$_[0]}="\$${label}${_[0]}"; |
342 | $label++; | 345 | $label++; |
343 | } | 346 | } |
344 | if((defined $_[2]) && ($_[2] == 1)) | 347 | if((defined $_[2]) && ($_[2] == 1)) |
@@ -363,3 +366,11 @@ sub out1p | |||
363 | 366 | ||
364 | push(@out,"\t$name\t ".&conv($p1)."\n"); | 367 | push(@out,"\t$name\t ".&conv($p1)."\n"); |
365 | } | 368 | } |
369 | |||
370 | sub main'picmeup | ||
371 | { | ||
372 | local($dst,$sym)=@_; | ||
373 | &main'lea($dst,&main'DWP($sym)); | ||
374 | } | ||
375 | |||
376 | sub main'blindpop { &out1("pop",@_); } | ||
diff --git a/src/lib/libcrypto/perlasm/x86nasm.pl b/src/lib/libcrypto/perlasm/x86nasm.pl index 519d8a5867..f30b7466d4 100644 --- a/src/lib/libcrypto/perlasm/x86nasm.pl +++ b/src/lib/libcrypto/perlasm/x86nasm.pl | |||
@@ -98,6 +98,8 @@ sub get_mem | |||
98 | $addr="_$addr"; | 98 | $addr="_$addr"; |
99 | } | 99 | } |
100 | 100 | ||
101 | if ($addr =~ /^.+\-.+$/) { $addr="($addr)"; } | ||
102 | |||
101 | $reg1="$regs{$reg1}" if defined($regs{$reg1}); | 103 | $reg1="$regs{$reg1}" if defined($regs{$reg1}); |
102 | $reg2="$regs{$reg2}" if defined($regs{$reg2}); | 104 | $reg2="$regs{$reg2}" if defined($regs{$reg2}); |
103 | if (($addr ne "") && ($addr ne 0)) | 105 | if (($addr ne "") && ($addr ne 0)) |
@@ -117,6 +119,7 @@ sub get_mem | |||
117 | { | 119 | { |
118 | $ret.="$reg1$post]" | 120 | $ret.="$reg1$post]" |
119 | } | 121 | } |
122 | $ret =~ s/\+\]/]/; # in case $addr was the only argument | ||
120 | return($ret); | 123 | return($ret); |
121 | } | 124 | } |
122 | 125 | ||
@@ -160,7 +163,7 @@ sub main'push { &out1("push",@_); $stack+=4; } | |||
160 | sub main'pop { &out1("pop",@_); $stack-=4; } | 163 | sub main'pop { &out1("pop",@_); $stack-=4; } |
161 | sub main'bswap { &out1("bswap",@_); &using486(); } | 164 | sub main'bswap { &out1("bswap",@_); &using486(); } |
162 | sub main'not { &out1("not",@_); } | 165 | sub main'not { &out1("not",@_); } |
163 | sub main'call { &out1("call",'_'.$_[0]); } | 166 | sub main'call { &out1("call",($_[0]=~/^\$L/?'':'_').$_[0]); } |
164 | sub main'ret { &out0("ret"); } | 167 | sub main'ret { &out0("ret"); } |
165 | sub main'nop { &out0("nop"); } | 168 | sub main'nop { &out0("nop"); } |
166 | 169 | ||
@@ -322,7 +325,7 @@ sub main'set_label | |||
322 | { | 325 | { |
323 | if (!defined($label{$_[0]})) | 326 | if (!defined($label{$_[0]})) |
324 | { | 327 | { |
325 | $label{$_[0]}="${label}${_[0]}"; | 328 | $label{$_[0]}="\$${label}${_[0]}"; |
326 | $label++; | 329 | $label++; |
327 | } | 330 | } |
328 | push(@out,"$label{$_[0]}:\n"); | 331 | push(@out,"$label{$_[0]}:\n"); |
@@ -340,3 +343,11 @@ sub out1p | |||
340 | 343 | ||
341 | push(@out,"\t$name\t ".&conv($p1)."\n"); | 344 | push(@out,"\t$name\t ".&conv($p1)."\n"); |
342 | } | 345 | } |
346 | |||
347 | sub main'picmeup | ||
348 | { | ||
349 | local($dst,$sym)=@_; | ||
350 | &main'lea($dst,&main'DWP($sym)); | ||
351 | } | ||
352 | |||
353 | sub main'blindpop { &out1("pop",@_); } | ||
diff --git a/src/lib/libcrypto/perlasm/x86unix.pl b/src/lib/libcrypto/perlasm/x86unix.pl index 9ceabf0705..72bde061c5 100644 --- a/src/lib/libcrypto/perlasm/x86unix.pl +++ b/src/lib/libcrypto/perlasm/x86unix.pl | |||
@@ -87,12 +87,12 @@ sub main'DWP | |||
87 | $ret.=$addr if ($addr ne "") && ($addr ne 0); | 87 | $ret.=$addr if ($addr ne "") && ($addr ne 0); |
88 | if ($reg2 ne "") | 88 | if ($reg2 ne "") |
89 | { | 89 | { |
90 | if($idx ne "") | 90 | if($idx ne "" && $idx != 0) |
91 | { $ret.="($reg1,$reg2,$idx)"; } | 91 | { $ret.="($reg1,$reg2,$idx)"; } |
92 | else | 92 | else |
93 | { $ret.="($reg1,$reg2)"; } | 93 | { $ret.="($reg1,$reg2)"; } |
94 | } | 94 | } |
95 | else | 95 | elsif ($reg1 ne "") |
96 | { $ret.="($reg1)" } | 96 | { $ret.="($reg1)" } |
97 | return($ret); | 97 | return($ret); |
98 | } | 98 | } |
@@ -167,7 +167,7 @@ sub main'pop { &out1("popl",@_); $stack-=4; } | |||
167 | sub main'pushf { &out0("pushf"); $stack+=4; } | 167 | sub main'pushf { &out0("pushf"); $stack+=4; } |
168 | sub main'popf { &out0("popf"); $stack-=4; } | 168 | sub main'popf { &out0("popf"); $stack-=4; } |
169 | sub main'not { &out1("notl",@_); } | 169 | sub main'not { &out1("notl",@_); } |
170 | sub main'call { &out1("call",$under.$_[0]); } | 170 | sub main'call { &out1("call",($_[0]=~/^\.L/?'':$under).$_[0]); } |
171 | sub main'ret { &out0("ret"); } | 171 | sub main'ret { &out0("ret"); } |
172 | sub main'nop { &out0("nop"); } | 172 | sub main'nop { &out0("nop"); } |
173 | 173 | ||
@@ -345,15 +345,15 @@ sub main'function_end | |||
345 | popl %ebx | 345 | popl %ebx |
346 | popl %ebp | 346 | popl %ebp |
347 | ret | 347 | ret |
348 | .${func}_end: | 348 | .L_${func}_end: |
349 | EOF | 349 | EOF |
350 | push(@out,$tmp); | 350 | push(@out,$tmp); |
351 | 351 | ||
352 | if ($main'cpp) | 352 | if ($main'cpp) |
353 | { push(@out,"\tSIZE($func,.${func}_end-$func)\n"); } | 353 | { push(@out,"\tSIZE($func,.L_${func}_end-$func)\n"); } |
354 | elsif ($main'gaswin) | 354 | elsif ($main'gaswin) |
355 | { $tmp=push(@out,"\t.align 4\n"); } | 355 | { $tmp=push(@out,"\t.align 4\n"); } |
356 | else { push(@out,"\t.size\t$func,.${func}_end-$func\n"); } | 356 | else { push(@out,"\t.size\t$func,.L_${func}_end-$func\n"); } |
357 | push(@out,".ident \"$func\"\n"); | 357 | push(@out,".ident \"$func\"\n"); |
358 | $stack=0; | 358 | $stack=0; |
359 | %label=(); | 359 | %label=(); |
@@ -426,6 +426,11 @@ sub main'swtmp | |||
426 | 426 | ||
427 | sub main'comment | 427 | sub main'comment |
428 | { | 428 | { |
429 | if ($main'elf) # GNU and SVR4 as'es use different comment delimiters, | ||
430 | { # so we just skip comments... | ||
431 | push(@out,"\n"); | ||
432 | return; | ||
433 | } | ||
429 | foreach (@_) | 434 | foreach (@_) |
430 | { | 435 | { |
431 | if (/^\s*$/) | 436 | if (/^\s*$/) |
@@ -542,3 +547,39 @@ sub popvars | |||
542 | &main'pop("edx"); | 547 | &main'pop("edx"); |
543 | &main'popf(); | 548 | &main'popf(); |
544 | } | 549 | } |
550 | |||
551 | sub main'picmeup | ||
552 | { | ||
553 | local($dst,$sym)=@_; | ||
554 | if ($main'cpp) | ||
555 | { | ||
556 | local($tmp)=<<___; | ||
557 | #if (defined(ELF) || defined(SOL)) && defined(PIC) | ||
558 | .align 8 | ||
559 | call 1f | ||
560 | 1: popl $regs{$dst} | ||
561 | addl \$_GLOBAL_OFFSET_TABLE_+[.-1b],$regs{$dst} | ||
562 | movl $sym\@GOT($regs{$dst}),$regs{$dst} | ||
563 | #else | ||
564 | leal $sym,$regs{$dst} | ||
565 | #endif | ||
566 | ___ | ||
567 | push(@out,$tmp); | ||
568 | } | ||
569 | elsif ($main'pic && ($main'elf || $main'aout)) | ||
570 | { | ||
571 | push(@out,"\t.align\t8\n"); | ||
572 | &main'call(&main'label("PIC_me_up")); | ||
573 | &main'set_label("PIC_me_up"); | ||
574 | &main'blindpop($dst); | ||
575 | &main'add($dst,"\$$under"."_GLOBAL_OFFSET_TABLE_+[.-". | ||
576 | &main'label("PIC_me_up") . "]"); | ||
577 | &main'mov($dst,&main'DWP($sym."\@GOT",$dst)); | ||
578 | } | ||
579 | else | ||
580 | { | ||
581 | &main'lea($dst,&main'DWP($sym)); | ||
582 | } | ||
583 | } | ||
584 | |||
585 | sub main'blindpop { &out1("popl",@_); } | ||
diff --git a/src/lib/libcrypto/pkcs7/bio_ber.c b/src/lib/libcrypto/pkcs7/bio_ber.c index 42331f7ab0..895a91177b 100644 --- a/src/lib/libcrypto/pkcs7/bio_ber.c +++ b/src/lib/libcrypto/pkcs7/bio_ber.c | |||
@@ -145,7 +145,7 @@ static int ber_free(BIO *a) | |||
145 | 145 | ||
146 | if (a == NULL) return(0); | 146 | if (a == NULL) return(0); |
147 | b=(BIO_BER_CTX *)a->ptr; | 147 | b=(BIO_BER_CTX *)a->ptr; |
148 | memset(a->ptr,0,sizeof(BIO_BER_CTX)); | 148 | OPENSSL_cleanse(a->ptr,sizeof(BIO_BER_CTX)); |
149 | OPENSSL_free(a->ptr); | 149 | OPENSSL_free(a->ptr); |
150 | a->ptr=NULL; | 150 | a->ptr=NULL; |
151 | a->init=0; | 151 | a->init=0; |
diff --git a/src/lib/libcrypto/rand/md_rand.c b/src/lib/libcrypto/rand/md_rand.c index a00ed70718..eeffc0df4c 100644 --- a/src/lib/libcrypto/rand/md_rand.c +++ b/src/lib/libcrypto/rand/md_rand.c | |||
@@ -177,10 +177,10 @@ RAND_METHOD *RAND_SSLeay(void) | |||
177 | 177 | ||
178 | static void ssleay_rand_cleanup(void) | 178 | static void ssleay_rand_cleanup(void) |
179 | { | 179 | { |
180 | memset(state,0,sizeof(state)); | 180 | OPENSSL_cleanse(state,sizeof(state)); |
181 | state_num=0; | 181 | state_num=0; |
182 | state_index=0; | 182 | state_index=0; |
183 | memset(md,0,MD_DIGEST_LENGTH); | 183 | OPENSSL_cleanse(md,MD_DIGEST_LENGTH); |
184 | md_count[0]=0; | 184 | md_count[0]=0; |
185 | md_count[1]=0; | 185 | md_count[1]=0; |
186 | entropy=0; | 186 | entropy=0; |
diff --git a/src/lib/libcrypto/rand/rand_egd.c b/src/lib/libcrypto/rand/rand_egd.c index abc3ac27d5..1f168221e3 100644 --- a/src/lib/libcrypto/rand/rand_egd.c +++ b/src/lib/libcrypto/rand/rand_egd.c | |||
@@ -94,7 +94,7 @@ | |||
94 | * RAND_egd() is a wrapper for RAND_egd_bytes() with numbytes=255. | 94 | * RAND_egd() is a wrapper for RAND_egd_bytes() with numbytes=255. |
95 | */ | 95 | */ |
96 | 96 | ||
97 | #if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_VMS) || defined(__DJGPP__) | 97 | #if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_VXWORKS) |
98 | int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes) | 98 | int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes) |
99 | { | 99 | { |
100 | return(-1); | 100 | return(-1); |
@@ -114,7 +114,7 @@ int RAND_egd_bytes(const char *path,int bytes) | |||
114 | #include <sys/types.h> | 114 | #include <sys/types.h> |
115 | #include <sys/socket.h> | 115 | #include <sys/socket.h> |
116 | #ifndef NO_SYS_UN_H | 116 | #ifndef NO_SYS_UN_H |
117 | # ifdef OPENSSL_SYS_VSWORKS | 117 | # ifdef OPENSSL_SYS_VXWORKS |
118 | # include <streams/un.h> | 118 | # include <streams/un.h> |
119 | # else | 119 | # else |
120 | # include <sys/un.h> | 120 | # include <sys/un.h> |
@@ -143,7 +143,7 @@ int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes) | |||
143 | 143 | ||
144 | memset(&addr, 0, sizeof(addr)); | 144 | memset(&addr, 0, sizeof(addr)); |
145 | addr.sun_family = AF_UNIX; | 145 | addr.sun_family = AF_UNIX; |
146 | if (strlen(path) > sizeof(addr.sun_path)) | 146 | if (strlen(path) >= sizeof(addr.sun_path)) |
147 | return (-1); | 147 | return (-1); |
148 | strcpy(addr.sun_path,path); | 148 | strcpy(addr.sun_path,path); |
149 | len = offsetof(struct sockaddr_un, sun_path) + strlen(path); | 149 | len = offsetof(struct sockaddr_un, sun_path) + strlen(path); |
diff --git a/src/lib/libcrypto/rand/rand_unix.c b/src/lib/libcrypto/rand/rand_unix.c index ec09d74603..a776e52243 100644 --- a/src/lib/libcrypto/rand/rand_unix.c +++ b/src/lib/libcrypto/rand/rand_unix.c | |||
@@ -115,7 +115,7 @@ | |||
115 | #include <openssl/rand.h> | 115 | #include <openssl/rand.h> |
116 | #include "rand_lcl.h" | 116 | #include "rand_lcl.h" |
117 | 117 | ||
118 | #if !(defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_OS2)) | 118 | #if !(defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_OS2) || defined(OPENSSL_SYS_VXWORKS)) |
119 | 119 | ||
120 | #include <sys/types.h> | 120 | #include <sys/types.h> |
121 | #include <sys/time.h> | 121 | #include <sys/time.h> |
@@ -215,7 +215,7 @@ int RAND_poll(void) | |||
215 | if (n > 0) | 215 | if (n > 0) |
216 | { | 216 | { |
217 | RAND_add(tmpbuf,sizeof tmpbuf,n); | 217 | RAND_add(tmpbuf,sizeof tmpbuf,n); |
218 | memset(tmpbuf,0,n); | 218 | OPENSSL_cleanse(tmpbuf,n); |
219 | } | 219 | } |
220 | #endif | 220 | #endif |
221 | 221 | ||
@@ -236,3 +236,10 @@ int RAND_poll(void) | |||
236 | } | 236 | } |
237 | 237 | ||
238 | #endif | 238 | #endif |
239 | |||
240 | #if defined(OPENSSL_SYS_VXWORKS) | ||
241 | int RAND_poll(void) | ||
242 | { | ||
243 | return 0; | ||
244 | } | ||
245 | #endif | ||
diff --git a/src/lib/libcrypto/rand/rand_win.c b/src/lib/libcrypto/rand/rand_win.c index c1b955b06f..113b58678f 100644 --- a/src/lib/libcrypto/rand/rand_win.c +++ b/src/lib/libcrypto/rand/rand_win.c | |||
@@ -125,7 +125,7 @@ | |||
125 | * http://developer.intel.com/design/security/rng/redist_license.htm | 125 | * http://developer.intel.com/design/security/rng/redist_license.htm |
126 | */ | 126 | */ |
127 | #define PROV_INTEL_SEC 22 | 127 | #define PROV_INTEL_SEC 22 |
128 | #define INTEL_DEF_PROV "Intel Hardware Cryptographic Service Provider" | 128 | #define INTEL_DEF_PROV TEXT("Intel Hardware Cryptographic Service Provider") |
129 | 129 | ||
130 | static void readtimer(void); | 130 | static void readtimer(void); |
131 | static void readscreen(void); | 131 | static void readscreen(void); |
@@ -170,7 +170,9 @@ typedef BOOL (WINAPI *THREAD32)(HANDLE, LPTHREADENTRY32); | |||
170 | typedef BOOL (WINAPI *MODULE32)(HANDLE, LPMODULEENTRY32); | 170 | typedef BOOL (WINAPI *MODULE32)(HANDLE, LPMODULEENTRY32); |
171 | 171 | ||
172 | #include <lmcons.h> | 172 | #include <lmcons.h> |
173 | #ifndef OPENSSL_SYS_WINCE | ||
173 | #include <lmstats.h> | 174 | #include <lmstats.h> |
175 | #endif | ||
174 | #if 1 /* The NET API is Unicode only. It requires the use of the UNICODE | 176 | #if 1 /* The NET API is Unicode only. It requires the use of the UNICODE |
175 | * macro. When UNICODE is defined LPTSTR becomes LPWSTR. LMSTR was | 177 | * macro. When UNICODE is defined LPTSTR becomes LPWSTR. LMSTR was |
176 | * was added to the Platform SDK to allow the NET API to be used in | 178 | * was added to the Platform SDK to allow the NET API to be used in |
@@ -209,20 +211,32 @@ int RAND_poll(void) | |||
209 | osverinfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO) ; | 211 | osverinfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO) ; |
210 | GetVersionEx( &osverinfo ) ; | 212 | GetVersionEx( &osverinfo ) ; |
211 | 213 | ||
214 | #if defined(OPENSSL_SYS_WINCE) && WCEPLATFORM!=MS_HPC_PRO | ||
215 | /* poll the CryptoAPI PRNG */ | ||
216 | /* The CryptoAPI returns sizeof(buf) bytes of randomness */ | ||
217 | if (CryptAcquireContext(&hProvider, 0, 0, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT)) | ||
218 | { | ||
219 | if (CryptGenRandom(hProvider, sizeof(buf), buf)) | ||
220 | RAND_add(buf, sizeof(buf), sizeof(buf)); | ||
221 | CryptReleaseContext(hProvider, 0); | ||
222 | } | ||
223 | #endif | ||
224 | |||
212 | /* load functions dynamically - not available on all systems */ | 225 | /* load functions dynamically - not available on all systems */ |
213 | advapi = LoadLibrary("ADVAPI32.DLL"); | 226 | advapi = LoadLibrary(TEXT("ADVAPI32.DLL")); |
214 | kernel = LoadLibrary("KERNEL32.DLL"); | 227 | kernel = LoadLibrary(TEXT("KERNEL32.DLL")); |
215 | user = LoadLibrary("USER32.DLL"); | 228 | user = LoadLibrary(TEXT("USER32.DLL")); |
216 | netapi = LoadLibrary("NETAPI32.DLL"); | 229 | netapi = LoadLibrary(TEXT("NETAPI32.DLL")); |
217 | 230 | ||
231 | #ifndef OPENSSL_SYS_WINCE | ||
218 | #if 1 /* There was previously a problem with NETSTATGET. Currently, this | 232 | #if 1 /* There was previously a problem with NETSTATGET. Currently, this |
219 | * section is still experimental, but if all goes well, this conditional | 233 | * section is still experimental, but if all goes well, this conditional |
220 | * will be removed | 234 | * will be removed |
221 | */ | 235 | */ |
222 | if (netapi) | 236 | if (netapi) |
223 | { | 237 | { |
224 | netstatget = (NETSTATGET) GetProcAddress(netapi,"NetStatisticsGet"); | 238 | netstatget = (NETSTATGET) GetProcAddress(netapi,TEXT("NetStatisticsGet")); |
225 | netfree = (NETFREE) GetProcAddress(netapi,"NetApiBufferFree"); | 239 | netfree = (NETFREE) GetProcAddress(netapi,TEXT("NetApiBufferFree")); |
226 | } | 240 | } |
227 | 241 | ||
228 | if (netstatget && netfree) | 242 | if (netstatget && netfree) |
@@ -249,7 +263,9 @@ int RAND_poll(void) | |||
249 | if (netapi) | 263 | if (netapi) |
250 | FreeLibrary(netapi); | 264 | FreeLibrary(netapi); |
251 | #endif /* 1 */ | 265 | #endif /* 1 */ |
266 | #endif /* !OPENSSL_SYS_WINCE */ | ||
252 | 267 | ||
268 | #ifndef OPENSSL_SYS_WINCE | ||
253 | /* It appears like this can cause an exception deep within ADVAPI32.DLL | 269 | /* It appears like this can cause an exception deep within ADVAPI32.DLL |
254 | * at random times on Windows 2000. Reported by Jeffrey Altman. | 270 | * at random times on Windows 2000. Reported by Jeffrey Altman. |
255 | * Only use it on NT. | 271 | * Only use it on NT. |
@@ -280,30 +296,40 @@ int RAND_poll(void) | |||
280 | bufsz += 8192; | 296 | bufsz += 8192; |
281 | 297 | ||
282 | length = bufsz; | 298 | length = bufsz; |
283 | rc = RegQueryValueEx(HKEY_PERFORMANCE_DATA, "Global", | 299 | rc = RegQueryValueEx(HKEY_PERFORMANCE_DATA, TEXT("Global"), |
284 | NULL, NULL, buf, &length); | 300 | NULL, NULL, buf, &length); |
285 | } | 301 | } |
286 | if (rc == ERROR_SUCCESS) | 302 | if (rc == ERROR_SUCCESS) |
287 | { | 303 | { |
288 | /* For entropy count assume only least significant | 304 | /* For entropy count assume only least significant |
289 | * byte of each DWORD is random. | 305 | * byte of each DWORD is random. |
290 | */ | 306 | */ |
291 | RAND_add(&length, sizeof(length), 0); | 307 | RAND_add(&length, sizeof(length), 0); |
292 | RAND_add(buf, length, length / 4.0); | 308 | RAND_add(buf, length, length / 4.0); |
309 | |||
310 | /* Close the Registry Key to allow Windows to cleanup/close | ||
311 | * the open handle | ||
312 | * Note: The 'HKEY_PERFORMANCE_DATA' key is implicitly opened | ||
313 | * when the RegQueryValueEx above is done. However, if | ||
314 | * it is not explicitly closed, it can cause disk | ||
315 | * partition manipulation problems. | ||
316 | */ | ||
317 | RegCloseKey(HKEY_PERFORMANCE_DATA); | ||
293 | } | 318 | } |
294 | if (buf) | 319 | if (buf) |
295 | free(buf); | 320 | free(buf); |
296 | } | 321 | } |
297 | #endif | 322 | #endif |
323 | #endif /* !OPENSSL_SYS_WINCE */ | ||
298 | 324 | ||
299 | if (advapi) | 325 | if (advapi) |
300 | { | 326 | { |
301 | acquire = (CRYPTACQUIRECONTEXT) GetProcAddress(advapi, | 327 | acquire = (CRYPTACQUIRECONTEXT) GetProcAddress(advapi, |
302 | "CryptAcquireContextA"); | 328 | TEXT("CryptAcquireContextA")); |
303 | gen = (CRYPTGENRANDOM) GetProcAddress(advapi, | 329 | gen = (CRYPTGENRANDOM) GetProcAddress(advapi, |
304 | "CryptGenRandom"); | 330 | TEXT("CryptGenRandom")); |
305 | release = (CRYPTRELEASECONTEXT) GetProcAddress(advapi, | 331 | release = (CRYPTRELEASECONTEXT) GetProcAddress(advapi, |
306 | "CryptReleaseContext"); | 332 | TEXT("CryptReleaseContext")); |
307 | } | 333 | } |
308 | 334 | ||
309 | if (acquire && gen && release) | 335 | if (acquire && gen && release) |
@@ -357,9 +383,9 @@ int RAND_poll(void) | |||
357 | GETFOREGROUNDWINDOW win; | 383 | GETFOREGROUNDWINDOW win; |
358 | GETQUEUESTATUS queue; | 384 | GETQUEUESTATUS queue; |
359 | 385 | ||
360 | win = (GETFOREGROUNDWINDOW) GetProcAddress(user, "GetForegroundWindow"); | 386 | win = (GETFOREGROUNDWINDOW) GetProcAddress(user, TEXT("GetForegroundWindow")); |
361 | cursor = (GETCURSORINFO) GetProcAddress(user, "GetCursorInfo"); | 387 | cursor = (GETCURSORINFO) GetProcAddress(user, TEXT("GetCursorInfo")); |
362 | queue = (GETQUEUESTATUS) GetProcAddress(user, "GetQueueStatus"); | 388 | queue = (GETQUEUESTATUS) GetProcAddress(user, TEXT("GetQueueStatus")); |
363 | 389 | ||
364 | if (win) | 390 | if (win) |
365 | { | 391 | { |
@@ -430,17 +456,17 @@ int RAND_poll(void) | |||
430 | MODULEENTRY32 m; | 456 | MODULEENTRY32 m; |
431 | 457 | ||
432 | snap = (CREATETOOLHELP32SNAPSHOT) | 458 | snap = (CREATETOOLHELP32SNAPSHOT) |
433 | GetProcAddress(kernel, "CreateToolhelp32Snapshot"); | 459 | GetProcAddress(kernel, TEXT("CreateToolhelp32Snapshot")); |
434 | heap_first = (HEAP32FIRST) GetProcAddress(kernel, "Heap32First"); | 460 | heap_first = (HEAP32FIRST) GetProcAddress(kernel, TEXT("Heap32First")); |
435 | heap_next = (HEAP32NEXT) GetProcAddress(kernel, "Heap32Next"); | 461 | heap_next = (HEAP32NEXT) GetProcAddress(kernel, TEXT("Heap32Next")); |
436 | heaplist_first = (HEAP32LIST) GetProcAddress(kernel, "Heap32ListFirst"); | 462 | heaplist_first = (HEAP32LIST) GetProcAddress(kernel, TEXT("Heap32ListFirst")); |
437 | heaplist_next = (HEAP32LIST) GetProcAddress(kernel, "Heap32ListNext"); | 463 | heaplist_next = (HEAP32LIST) GetProcAddress(kernel, TEXT("Heap32ListNext")); |
438 | process_first = (PROCESS32) GetProcAddress(kernel, "Process32First"); | 464 | process_first = (PROCESS32) GetProcAddress(kernel, TEXT("Process32First")); |
439 | process_next = (PROCESS32) GetProcAddress(kernel, "Process32Next"); | 465 | process_next = (PROCESS32) GetProcAddress(kernel, TEXT("Process32Next")); |
440 | thread_first = (THREAD32) GetProcAddress(kernel, "Thread32First"); | 466 | thread_first = (THREAD32) GetProcAddress(kernel, TEXT("Thread32First")); |
441 | thread_next = (THREAD32) GetProcAddress(kernel, "Thread32Next"); | 467 | thread_next = (THREAD32) GetProcAddress(kernel, TEXT("Thread32Next")); |
442 | module_first = (MODULE32) GetProcAddress(kernel, "Module32First"); | 468 | module_first = (MODULE32) GetProcAddress(kernel, TEXT("Module32First")); |
443 | module_next = (MODULE32) GetProcAddress(kernel, "Module32Next"); | 469 | module_next = (MODULE32) GetProcAddress(kernel, TEXT("Module32Next")); |
444 | 470 | ||
445 | if (snap && heap_first && heap_next && heaplist_first && | 471 | if (snap && heap_first && heap_next && heaplist_first && |
446 | heaplist_next && process_first && process_next && | 472 | heaplist_next && process_first && process_next && |
@@ -575,7 +601,7 @@ static void readtimer(void) | |||
575 | DWORD w; | 601 | DWORD w; |
576 | LARGE_INTEGER l; | 602 | LARGE_INTEGER l; |
577 | static int have_perfc = 1; | 603 | static int have_perfc = 1; |
578 | #ifdef _MSC_VER | 604 | #if defined(_MSC_VER) && !defined(OPENSSL_SYS_WINCE) |
579 | static int have_tsc = 1; | 605 | static int have_tsc = 1; |
580 | DWORD cyclecount; | 606 | DWORD cyclecount; |
581 | 607 | ||
@@ -628,6 +654,7 @@ static void readtimer(void) | |||
628 | 654 | ||
629 | static void readscreen(void) | 655 | static void readscreen(void) |
630 | { | 656 | { |
657 | #ifndef OPENSSL_SYS_WINCE | ||
631 | HDC hScrDC; /* screen DC */ | 658 | HDC hScrDC; /* screen DC */ |
632 | HDC hMemDC; /* memory DC */ | 659 | HDC hMemDC; /* memory DC */ |
633 | HBITMAP hBitmap; /* handle for our bitmap */ | 660 | HBITMAP hBitmap; /* handle for our bitmap */ |
@@ -641,7 +668,7 @@ static void readscreen(void) | |||
641 | int n = 16; /* number of screen lines to grab at a time */ | 668 | int n = 16; /* number of screen lines to grab at a time */ |
642 | 669 | ||
643 | /* Create a screen DC and a memory DC compatible to screen DC */ | 670 | /* Create a screen DC and a memory DC compatible to screen DC */ |
644 | hScrDC = CreateDC("DISPLAY", NULL, NULL, NULL); | 671 | hScrDC = CreateDC(TEXT("DISPLAY"), NULL, NULL, NULL); |
645 | hMemDC = CreateCompatibleDC(hScrDC); | 672 | hMemDC = CreateCompatibleDC(hScrDC); |
646 | 673 | ||
647 | /* Get screen resolution */ | 674 | /* Get screen resolution */ |
@@ -688,6 +715,7 @@ static void readscreen(void) | |||
688 | DeleteObject(hBitmap); | 715 | DeleteObject(hBitmap); |
689 | DeleteDC(hMemDC); | 716 | DeleteDC(hMemDC); |
690 | DeleteDC(hScrDC); | 717 | DeleteDC(hScrDC); |
718 | #endif /* !OPENSSL_SYS_WINCE */ | ||
691 | } | 719 | } |
692 | 720 | ||
693 | #endif | 721 | #endif |
diff --git a/src/lib/libcrypto/rand/randtest.c b/src/lib/libcrypto/rand/randtest.c index b64de616db..701932e6ee 100644 --- a/src/lib/libcrypto/rand/randtest.c +++ b/src/lib/libcrypto/rand/randtest.c | |||
@@ -60,6 +60,8 @@ | |||
60 | #include <stdlib.h> | 60 | #include <stdlib.h> |
61 | #include <openssl/rand.h> | 61 | #include <openssl/rand.h> |
62 | 62 | ||
63 | #include "../e_os.h" | ||
64 | |||
63 | /* some FIPS 140-1 random number test */ | 65 | /* some FIPS 140-1 random number test */ |
64 | /* some simple tests */ | 66 | /* some simple tests */ |
65 | 67 | ||
@@ -209,6 +211,6 @@ int main() | |||
209 | printf("test 4 done\n"); | 211 | printf("test 4 done\n"); |
210 | err: | 212 | err: |
211 | err=((err)?1:0); | 213 | err=((err)?1:0); |
212 | exit(err); | 214 | EXIT(err); |
213 | return(err); | 215 | return(err); |
214 | } | 216 | } |
diff --git a/src/lib/libcrypto/rc2/rc2test.c b/src/lib/libcrypto/rc2/rc2test.c index d9a2a0a1cb..b67bafb49f 100644 --- a/src/lib/libcrypto/rc2/rc2test.c +++ b/src/lib/libcrypto/rc2/rc2test.c | |||
@@ -63,6 +63,8 @@ | |||
63 | #include <string.h> | 63 | #include <string.h> |
64 | #include <stdlib.h> | 64 | #include <stdlib.h> |
65 | 65 | ||
66 | #include "../e_os.h" | ||
67 | |||
66 | #ifdef OPENSSL_NO_RC2 | 68 | #ifdef OPENSSL_NO_RC2 |
67 | int main(int argc, char *argv[]) | 69 | int main(int argc, char *argv[]) |
68 | { | 70 | { |
@@ -203,7 +205,7 @@ int main(int argc, char *argv[]) | |||
203 | printf("ok\n"); | 205 | printf("ok\n"); |
204 | #endif | 206 | #endif |
205 | 207 | ||
206 | exit(err); | 208 | EXIT(err); |
207 | return(err); | 209 | return(err); |
208 | } | 210 | } |
209 | 211 | ||
diff --git a/src/lib/libcrypto/rc4/rc4.c b/src/lib/libcrypto/rc4/rc4.c index c2165b0b75..b39c070292 100644 --- a/src/lib/libcrypto/rc4/rc4.c +++ b/src/lib/libcrypto/rc4/rc4.c | |||
@@ -155,7 +155,7 @@ bad: | |||
155 | i=EVP_read_pw_string(buf,BUFSIZ,"Enter RC4 password:",0); | 155 | i=EVP_read_pw_string(buf,BUFSIZ,"Enter RC4 password:",0); |
156 | if (i != 0) | 156 | if (i != 0) |
157 | { | 157 | { |
158 | memset(buf,0,BUFSIZ); | 158 | OPENSSL_cleanse(buf,BUFSIZ); |
159 | fprintf(stderr,"bad password read\n"); | 159 | fprintf(stderr,"bad password read\n"); |
160 | exit(1); | 160 | exit(1); |
161 | } | 161 | } |
@@ -163,7 +163,7 @@ bad: | |||
163 | } | 163 | } |
164 | 164 | ||
165 | EVP_Digest((unsigned char *)keystr,(unsigned long)strlen(keystr),md,NULL,EVP_md5()); | 165 | EVP_Digest((unsigned char *)keystr,(unsigned long)strlen(keystr),md,NULL,EVP_md5()); |
166 | memset(keystr,0,strlen(keystr)); | 166 | OPENSSL_cleanse(keystr,strlen(keystr)); |
167 | RC4_set_key(&key,MD5_DIGEST_LENGTH,md); | 167 | RC4_set_key(&key,MD5_DIGEST_LENGTH,md); |
168 | 168 | ||
169 | for(;;) | 169 | for(;;) |
diff --git a/src/lib/libcrypto/rc4/rc4test.c b/src/lib/libcrypto/rc4/rc4test.c index a28d457c8d..b9d8f20975 100644 --- a/src/lib/libcrypto/rc4/rc4test.c +++ b/src/lib/libcrypto/rc4/rc4test.c | |||
@@ -60,6 +60,8 @@ | |||
60 | #include <stdlib.h> | 60 | #include <stdlib.h> |
61 | #include <string.h> | 61 | #include <string.h> |
62 | 62 | ||
63 | #include "../e_os.h" | ||
64 | |||
63 | #ifdef OPENSSL_NO_RC4 | 65 | #ifdef OPENSSL_NO_RC4 |
64 | int main(int argc, char *argv[]) | 66 | int main(int argc, char *argv[]) |
65 | { | 67 | { |
@@ -195,7 +197,7 @@ int main(int argc, char *argv[]) | |||
195 | } | 197 | } |
196 | } | 198 | } |
197 | printf("done\n"); | 199 | printf("done\n"); |
198 | exit(err); | 200 | EXIT(err); |
199 | return(0); | 201 | return(0); |
200 | } | 202 | } |
201 | #endif | 203 | #endif |
diff --git a/src/lib/libcrypto/rc5/rc5s.cpp b/src/lib/libcrypto/rc5/rc5s.cpp new file mode 100644 index 0000000000..1c5518bc80 --- /dev/null +++ b/src/lib/libcrypto/rc5/rc5s.cpp | |||
@@ -0,0 +1,70 @@ | |||
1 | // | ||
2 | // gettsc.inl | ||
3 | // | ||
4 | // gives access to the Pentium's (secret) cycle counter | ||
5 | // | ||
6 | // This software was written by Leonard Janke (janke@unixg.ubc.ca) | ||
7 | // in 1996-7 and is entered, by him, into the public domain. | ||
8 | |||
9 | #if defined(__WATCOMC__) | ||
10 | void GetTSC(unsigned long&); | ||
11 | #pragma aux GetTSC = 0x0f 0x31 "mov [edi], eax" parm [edi] modify [edx eax]; | ||
12 | #elif defined(__GNUC__) | ||
13 | inline | ||
14 | void GetTSC(unsigned long& tsc) | ||
15 | { | ||
16 | asm volatile(".byte 15, 49\n\t" | ||
17 | : "=eax" (tsc) | ||
18 | : | ||
19 | : "%edx", "%eax"); | ||
20 | } | ||
21 | #elif defined(_MSC_VER) | ||
22 | inline | ||
23 | void GetTSC(unsigned long& tsc) | ||
24 | { | ||
25 | unsigned long a; | ||
26 | __asm _emit 0fh | ||
27 | __asm _emit 31h | ||
28 | __asm mov a, eax; | ||
29 | tsc=a; | ||
30 | } | ||
31 | #endif | ||
32 | |||
33 | #include <stdio.h> | ||
34 | #include <stdlib.h> | ||
35 | #include <openssl/rc5.h> | ||
36 | |||
37 | void main(int argc,char *argv[]) | ||
38 | { | ||
39 | RC5_32_KEY key; | ||
40 | unsigned long s1,s2,e1,e2; | ||
41 | unsigned long data[2]; | ||
42 | int i,j; | ||
43 | static unsigned char d[16]={0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF}; | ||
44 | |||
45 | RC5_32_set_key(&key, 16,d,12); | ||
46 | |||
47 | for (j=0; j<6; j++) | ||
48 | { | ||
49 | for (i=0; i<1000; i++) /**/ | ||
50 | { | ||
51 | RC5_32_encrypt(&data[0],&key); | ||
52 | GetTSC(s1); | ||
53 | RC5_32_encrypt(&data[0],&key); | ||
54 | RC5_32_encrypt(&data[0],&key); | ||
55 | RC5_32_encrypt(&data[0],&key); | ||
56 | GetTSC(e1); | ||
57 | GetTSC(s2); | ||
58 | RC5_32_encrypt(&data[0],&key); | ||
59 | RC5_32_encrypt(&data[0],&key); | ||
60 | RC5_32_encrypt(&data[0],&key); | ||
61 | RC5_32_encrypt(&data[0],&key); | ||
62 | GetTSC(e2); | ||
63 | RC5_32_encrypt(&data[0],&key); | ||
64 | } | ||
65 | |||
66 | printf("cast %d %d (%d)\n", | ||
67 | e1-s1,e2-s2,((e2-s2)-(e1-s1))); | ||
68 | } | ||
69 | } | ||
70 | |||
diff --git a/src/lib/libcrypto/ripemd/rmd160.c b/src/lib/libcrypto/ripemd/rmd160.c index 4f8b88a18a..b0ec574498 100644 --- a/src/lib/libcrypto/ripemd/rmd160.c +++ b/src/lib/libcrypto/ripemd/rmd160.c | |||
@@ -64,7 +64,7 @@ | |||
64 | 64 | ||
65 | void do_fp(FILE *f); | 65 | void do_fp(FILE *f); |
66 | void pt(unsigned char *md); | 66 | void pt(unsigned char *md); |
67 | #ifndef _OSD_POSIX | 67 | #if !defined(_OSD_POSIX) && !defined(__DJGPP__) |
68 | int read(int, void *, unsigned int); | 68 | int read(int, void *, unsigned int); |
69 | #endif | 69 | #endif |
70 | 70 | ||
diff --git a/src/lib/libcrypto/ripemd/rmdtest.c b/src/lib/libcrypto/ripemd/rmdtest.c index be1fb8b1f6..d4c709e646 100644 --- a/src/lib/libcrypto/ripemd/rmdtest.c +++ b/src/lib/libcrypto/ripemd/rmdtest.c | |||
@@ -60,6 +60,8 @@ | |||
60 | #include <string.h> | 60 | #include <string.h> |
61 | #include <stdlib.h> | 61 | #include <stdlib.h> |
62 | 62 | ||
63 | #include "../e_os.h" | ||
64 | |||
63 | #ifdef OPENSSL_NO_RIPEMD | 65 | #ifdef OPENSSL_NO_RIPEMD |
64 | int main(int argc, char *argv[]) | 66 | int main(int argc, char *argv[]) |
65 | { | 67 | { |
@@ -127,7 +129,7 @@ int main(int argc, char *argv[]) | |||
127 | R++; | 129 | R++; |
128 | P++; | 130 | P++; |
129 | } | 131 | } |
130 | exit(err); | 132 | EXIT(err); |
131 | return(0); | 133 | return(0); |
132 | } | 134 | } |
133 | 135 | ||
diff --git a/src/lib/libcrypto/rsa/rsa_test.c b/src/lib/libcrypto/rsa/rsa_test.c index b8b462d33b..924e9ad1f6 100644 --- a/src/lib/libcrypto/rsa/rsa_test.c +++ b/src/lib/libcrypto/rsa/rsa_test.c | |||
@@ -16,7 +16,6 @@ int main(int argc, char *argv[]) | |||
16 | } | 16 | } |
17 | #else | 17 | #else |
18 | #include <openssl/rsa.h> | 18 | #include <openssl/rsa.h> |
19 | #include <openssl/engine.h> | ||
20 | 19 | ||
21 | #define SetKey \ | 20 | #define SetKey \ |
22 | key->n = BN_bin2bn(n, sizeof(n)-1, key->n); \ | 21 | key->n = BN_bin2bn(n, sizeof(n)-1, key->n); \ |
diff --git a/src/lib/libcrypto/sha/sha1test.c b/src/lib/libcrypto/sha/sha1test.c index 499a1cf5af..4f2e4ada2d 100644 --- a/src/lib/libcrypto/sha/sha1test.c +++ b/src/lib/libcrypto/sha/sha1test.c | |||
@@ -60,6 +60,8 @@ | |||
60 | #include <string.h> | 60 | #include <string.h> |
61 | #include <stdlib.h> | 61 | #include <stdlib.h> |
62 | 62 | ||
63 | #include "../e_os.h" | ||
64 | |||
63 | #ifdef OPENSSL_NO_SHA | 65 | #ifdef OPENSSL_NO_SHA |
64 | int main(int argc, char *argv[]) | 66 | int main(int argc, char *argv[]) |
65 | { | 67 | { |
@@ -155,7 +157,7 @@ int main(int argc, char *argv[]) | |||
155 | } | 157 | } |
156 | else | 158 | else |
157 | printf("test 3 ok\n"); | 159 | printf("test 3 ok\n"); |
158 | exit(err); | 160 | EXIT(err); |
159 | EVP_MD_CTX_cleanup(&c); | 161 | EVP_MD_CTX_cleanup(&c); |
160 | return(0); | 162 | return(0); |
161 | } | 163 | } |
diff --git a/src/lib/libcrypto/sha/sha_one.c b/src/lib/libcrypto/sha/sha_one.c index 5426faae4a..e61c63f3e9 100644 --- a/src/lib/libcrypto/sha/sha_one.c +++ b/src/lib/libcrypto/sha/sha_one.c | |||
@@ -59,6 +59,7 @@ | |||
59 | #include <stdio.h> | 59 | #include <stdio.h> |
60 | #include <string.h> | 60 | #include <string.h> |
61 | #include <openssl/sha.h> | 61 | #include <openssl/sha.h> |
62 | #include <openssl/crypto.h> | ||
62 | 63 | ||
63 | #ifndef OPENSSL_NO_SHA0 | 64 | #ifndef OPENSSL_NO_SHA0 |
64 | unsigned char *SHA(const unsigned char *d, unsigned long n, unsigned char *md) | 65 | unsigned char *SHA(const unsigned char *d, unsigned long n, unsigned char *md) |
@@ -70,7 +71,7 @@ unsigned char *SHA(const unsigned char *d, unsigned long n, unsigned char *md) | |||
70 | SHA_Init(&c); | 71 | SHA_Init(&c); |
71 | SHA_Update(&c,d,n); | 72 | SHA_Update(&c,d,n); |
72 | SHA_Final(md,&c); | 73 | SHA_Final(md,&c); |
73 | memset(&c,0,sizeof(c)); | 74 | OPENSSL_cleanse(&c,sizeof(c)); |
74 | return(md); | 75 | return(md); |
75 | } | 76 | } |
76 | #endif | 77 | #endif |
diff --git a/src/lib/libcrypto/sha/shatest.c b/src/lib/libcrypto/sha/shatest.c index 331294a74f..5d2b1d3b1a 100644 --- a/src/lib/libcrypto/sha/shatest.c +++ b/src/lib/libcrypto/sha/shatest.c | |||
@@ -60,6 +60,8 @@ | |||
60 | #include <string.h> | 60 | #include <string.h> |
61 | #include <stdlib.h> | 61 | #include <stdlib.h> |
62 | 62 | ||
63 | #include "../e_os.h" | ||
64 | |||
63 | #ifdef OPENSSL_NO_SHA | 65 | #ifdef OPENSSL_NO_SHA |
64 | int main(int argc, char *argv[]) | 66 | int main(int argc, char *argv[]) |
65 | { | 67 | { |
@@ -156,7 +158,7 @@ int main(int argc, char *argv[]) | |||
156 | else | 158 | else |
157 | printf("test 3 ok\n"); | 159 | printf("test 3 ok\n"); |
158 | EVP_MD_CTX_cleanup(&c); | 160 | EVP_MD_CTX_cleanup(&c); |
159 | exit(err); | 161 | EXIT(err); |
160 | return(0); | 162 | return(0); |
161 | } | 163 | } |
162 | 164 | ||
diff --git a/src/lib/libcrypto/threads/mttest.c b/src/lib/libcrypto/threads/mttest.c index 7142e4edc7..54d598565d 100644 --- a/src/lib/libcrypto/threads/mttest.c +++ b/src/lib/libcrypto/threads/mttest.c | |||
@@ -86,11 +86,6 @@ | |||
86 | #include <openssl/err.h> | 86 | #include <openssl/err.h> |
87 | #include <openssl/rand.h> | 87 | #include <openssl/rand.h> |
88 | 88 | ||
89 | #ifdef OPENSSL_NO_FP_API | ||
90 | #define APPS_WIN16 | ||
91 | #include "../buffer/bss_file.c" | ||
92 | #endif | ||
93 | |||
94 | #define TEST_SERVER_CERT "../../apps/server.pem" | 89 | #define TEST_SERVER_CERT "../../apps/server.pem" |
95 | #define TEST_CLIENT_CERT "../../apps/client.pem" | 90 | #define TEST_CLIENT_CERT "../../apps/client.pem" |
96 | 91 | ||
diff --git a/src/lib/libcrypto/tmdiff.c b/src/lib/libcrypto/tmdiff.c index 7ebf2b202a..307523ebba 100644 --- a/src/lib/libcrypto/tmdiff.c +++ b/src/lib/libcrypto/tmdiff.c | |||
@@ -59,13 +59,16 @@ | |||
59 | #include <stdlib.h> | 59 | #include <stdlib.h> |
60 | #include "cryptlib.h" | 60 | #include "cryptlib.h" |
61 | #include <openssl/tmdiff.h> | 61 | #include <openssl/tmdiff.h> |
62 | #if !defined(OPENSSL_SYS_MSDOS) | ||
63 | #include OPENSSL_UNISTD | ||
64 | #endif | ||
62 | 65 | ||
63 | #ifdef TIMEB | 66 | #ifdef TIMEB |
64 | #undef OPENSSL_SYS_WIN32 | 67 | #undef OPENSSL_SYS_WIN32 |
65 | #undef TIMES | 68 | #undef TIMES |
66 | #endif | 69 | #endif |
67 | 70 | ||
68 | #if !defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_WIN32) && !defined(OPENSSL_SYS_VMS) || defined(__DECC) && !defined(OPENSSL_SYS_MACOSX) && !defined(OPENSSL_SYS_VXWORKS) | 71 | #if !defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_WIN32) && !(defined(OPENSSL_SYS_VMS) || defined(__DECC)) && !defined(OPENSSL_SYS_MACOSX_RHAPSODY) && !defined(OPENSSL_SYS_VXWORKS) |
69 | # define TIMES | 72 | # define TIMES |
70 | #endif | 73 | #endif |
71 | 74 | ||
@@ -101,14 +104,19 @@ | |||
101 | 104 | ||
102 | /* The following if from times(3) man page. It may need to be changed */ | 105 | /* The following if from times(3) man page. It may need to be changed */ |
103 | #ifndef HZ | 106 | #ifndef HZ |
104 | # ifndef CLK_TCK | 107 | # if defined(_SC_CLK_TCK) \ |
105 | # ifndef _BSD_CLK_TCK_ /* FreeBSD hack */ | 108 | && (!defined(OPENSSL_SYS_VMS) || __CTRL_VER >= 70000000) |
106 | # define HZ 100.0 | 109 | # define HZ ((double)sysconf(_SC_CLK_TCK)) |
107 | # else /* _BSD_CLK_TCK_ */ | 110 | # else |
108 | # define HZ ((double)_BSD_CLK_TCK_) | 111 | # ifndef CLK_TCK |
112 | # ifndef _BSD_CLK_TCK_ /* FreeBSD hack */ | ||
113 | # define HZ 100.0 | ||
114 | # else /* _BSD_CLK_TCK_ */ | ||
115 | # define HZ ((double)_BSD_CLK_TCK_) | ||
116 | # endif | ||
117 | # else /* CLK_TCK */ | ||
118 | # define HZ ((double)CLK_TCK) | ||
109 | # endif | 119 | # endif |
110 | # else /* CLK_TCK */ | ||
111 | # define HZ ((double)CLK_TCK) | ||
112 | # endif | 120 | # endif |
113 | #endif | 121 | #endif |
114 | 122 | ||
@@ -121,7 +129,7 @@ typedef struct ms_tm | |||
121 | HANDLE thread_id; | 129 | HANDLE thread_id; |
122 | FILETIME ms_win32; | 130 | FILETIME ms_win32; |
123 | # else | 131 | # else |
124 | # ifdef OPENSSL_SYS_VSWORKS | 132 | # ifdef OPENSSL_SYS_VXWORKS |
125 | unsigned long ticks; | 133 | unsigned long ticks; |
126 | # else | 134 | # else |
127 | struct timeb ms_timeb; | 135 | struct timeb ms_timeb; |
@@ -163,7 +171,7 @@ void ms_time_get(char *a) | |||
163 | # ifdef OPENSSL_SYS_WIN32 | 171 | # ifdef OPENSSL_SYS_WIN32 |
164 | GetThreadTimes(tm->thread_id,&tmpa,&tmpb,&tmpc,&(tm->ms_win32)); | 172 | GetThreadTimes(tm->thread_id,&tmpa,&tmpb,&tmpc,&(tm->ms_win32)); |
165 | # else | 173 | # else |
166 | # ifdef OPENSSL_SYS_VSWORKS | 174 | # ifdef OPENSSL_SYS_VXWORKS |
167 | tm->ticks = tickGet(); | 175 | tm->ticks = tickGet(); |
168 | # else | 176 | # else |
169 | ftime(&tm->ms_timeb); | 177 | ftime(&tm->ms_timeb); |
@@ -197,7 +205,7 @@ double ms_time_diff(char *ap, char *bp) | |||
197 | ret=((double)(lb-la))/1e7; | 205 | ret=((double)(lb-la))/1e7; |
198 | } | 206 | } |
199 | # else | 207 | # else |
200 | # ifdef OPENSSL_SYS_VSWORKS | 208 | # ifdef OPENSSL_SYS_VXWORKS |
201 | ret = (double)(b->ticks - a->ticks) / (double)sysClkRateGet(); | 209 | ret = (double)(b->ticks - a->ticks) / (double)sysClkRateGet(); |
202 | # else | 210 | # else |
203 | ret= (double)(b->ms_timeb.time-a->ms_timeb.time)+ | 211 | ret= (double)(b->ms_timeb.time-a->ms_timeb.time)+ |
@@ -222,7 +230,7 @@ int ms_time_cmp(char *ap, char *bp) | |||
222 | d =(b->ms_win32.dwHighDateTime&0x000fffff)*10+b->ms_win32.dwLowDateTime/1e7; | 230 | d =(b->ms_win32.dwHighDateTime&0x000fffff)*10+b->ms_win32.dwLowDateTime/1e7; |
223 | d-=(a->ms_win32.dwHighDateTime&0x000fffff)*10+a->ms_win32.dwLowDateTime/1e7; | 231 | d-=(a->ms_win32.dwHighDateTime&0x000fffff)*10+a->ms_win32.dwLowDateTime/1e7; |
224 | # else | 232 | # else |
225 | # ifdef OPENSSL_SYS_VSWORKS | 233 | # ifdef OPENSSL_SYS_VXWORKS |
226 | d = (b->ticks - a->ticks); | 234 | d = (b->ticks - a->ticks); |
227 | # else | 235 | # else |
228 | d= (double)(b->ms_timeb.time-a->ms_timeb.time)+ | 236 | d= (double)(b->ms_timeb.time-a->ms_timeb.time)+ |
diff --git a/src/lib/libcrypto/uid.c b/src/lib/libcrypto/uid.c index d3d249c36f..73205a4baa 100644 --- a/src/lib/libcrypto/uid.c +++ b/src/lib/libcrypto/uid.c | |||
@@ -65,7 +65,7 @@ int OPENSSL_issetugid(void) | |||
65 | return issetugid(); | 65 | return issetugid(); |
66 | } | 66 | } |
67 | 67 | ||
68 | #elif defined(OPENSSL_SYS_WIN32) | 68 | #elif defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_VXWORKS) |
69 | 69 | ||
70 | int OPENSSL_issetugid(void) | 70 | int OPENSSL_issetugid(void) |
71 | { | 71 | { |
diff --git a/src/lib/libcrypto/util/bat.sh b/src/lib/libcrypto/util/bat.sh index c6f48e8a7b..4d9a8287d0 100644 --- a/src/lib/libcrypto/util/bat.sh +++ b/src/lib/libcrypto/util/bat.sh | |||
@@ -62,6 +62,7 @@ sub var_add | |||
62 | local($dir,$val)=@_; | 62 | local($dir,$val)=@_; |
63 | local(@a,$_,$ret); | 63 | local(@a,$_,$ret); |
64 | 64 | ||
65 | return("") if $no_engine && $dir =~ /\/engine/; | ||
65 | return("") if $no_idea && $dir =~ /\/idea/; | 66 | return("") if $no_idea && $dir =~ /\/idea/; |
66 | return("") if $no_rc2 && $dir =~ /\/rc2/; | 67 | return("") if $no_rc2 && $dir =~ /\/rc2/; |
67 | return("") if $no_rc4 && $dir =~ /\/rc4/; | 68 | return("") if $no_rc4 && $dir =~ /\/rc4/; |
@@ -116,6 +117,7 @@ sub var_add | |||
116 | @a=grep(!/(^sha1)|(_sha1$)|(m_dss1$)/,@a) if $no_sha1; | 117 | @a=grep(!/(^sha1)|(_sha1$)|(m_dss1$)/,@a) if $no_sha1; |
117 | @a=grep(!/_mdc2$/,@a) if $no_mdc2; | 118 | @a=grep(!/_mdc2$/,@a) if $no_mdc2; |
118 | 119 | ||
120 | @a=grep(!/^engine$/,@a) if $no_engine; | ||
119 | @a=grep(!/(^rsa$)|(^genrsa$)|(^req$)|(^ca$)/,@a) if $no_rsa; | 121 | @a=grep(!/(^rsa$)|(^genrsa$)|(^req$)|(^ca$)/,@a) if $no_rsa; |
120 | @a=grep(!/(^dsa$)|(^gendsa$)|(^dsaparam$)/,@a) if $no_dsa; | 122 | @a=grep(!/(^dsa$)|(^gendsa$)|(^dsaparam$)/,@a) if $no_dsa; |
121 | @a=grep(!/^gendsa$/,@a) if $no_sha1; | 123 | @a=grep(!/^gendsa$/,@a) if $no_sha1; |
diff --git a/src/lib/libcrypto/util/cygwin.sh b/src/lib/libcrypto/util/cygwin.sh index b607399b02..930f766b4f 100644 --- a/src/lib/libcrypto/util/cygwin.sh +++ b/src/lib/libcrypto/util/cygwin.sh | |||
@@ -96,6 +96,8 @@ fi | |||
96 | 96 | ||
97 | get_openssl_version | 97 | get_openssl_version |
98 | 98 | ||
99 | make depend || exit 1 | ||
100 | |||
99 | make || exit 1 | 101 | make || exit 1 |
100 | 102 | ||
101 | base_install | 103 | base_install |
diff --git a/src/lib/libcrypto/util/domd b/src/lib/libcrypto/util/domd index 8cbe383c16..49310bbdd1 100644 --- a/src/lib/libcrypto/util/domd +++ b/src/lib/libcrypto/util/domd | |||
@@ -15,9 +15,14 @@ cp Makefile.ssl Makefile.save | |||
15 | # fake the presence of Kerberos | 15 | # fake the presence of Kerberos |
16 | touch $TOP/krb5.h | 16 | touch $TOP/krb5.h |
17 | if [ "$MAKEDEPEND" = "gcc" ]; then | 17 | if [ "$MAKEDEPEND" = "gcc" ]; then |
18 | args="" | ||
19 | while [ $# -gt 0 ]; do | ||
20 | if [ "$1" != "--" ]; then args="$args $1"; fi | ||
21 | shift | ||
22 | done | ||
18 | sed -e '/^# DO NOT DELETE.*/,$d' < Makefile.ssl > Makefile.tmp | 23 | sed -e '/^# DO NOT DELETE.*/,$d' < Makefile.ssl > Makefile.tmp |
19 | echo '# DO NOT DELETE THIS LINE -- make depend depends on it.' >> Makefile.tmp | 24 | echo '# DO NOT DELETE THIS LINE -- make depend depends on it.' >> Makefile.tmp |
20 | gcc -D OPENSSL_DOING_MAKEDEPEND -M $@ >> Makefile.tmp | 25 | gcc -D OPENSSL_DOING_MAKEDEPEND -M $args >> Makefile.tmp |
21 | ${PERL} $TOP/util/clean-depend.pl < Makefile.tmp > Makefile.new | 26 | ${PERL} $TOP/util/clean-depend.pl < Makefile.tmp > Makefile.new |
22 | rm -f Makefile.tmp | 27 | rm -f Makefile.tmp |
23 | else | 28 | else |
diff --git a/src/lib/libcrypto/util/extract-names.pl b/src/lib/libcrypto/util/extract-names.pl new file mode 100644 index 0000000000..d413a045cc --- /dev/null +++ b/src/lib/libcrypto/util/extract-names.pl | |||
@@ -0,0 +1,22 @@ | |||
1 | #!/usr/bin/perl | ||
2 | |||
3 | $/ = ""; # Eat a paragraph at once. | ||
4 | while(<STDIN>) { | ||
5 | chop; | ||
6 | s/\n/ /gm; | ||
7 | if (/^=head1 /) { | ||
8 | $name = 0; | ||
9 | } elsif ($name) { | ||
10 | if (/ - /) { | ||
11 | s/ - .*//; | ||
12 | s/[ \t,]+/ /g; | ||
13 | push @words, split ' '; | ||
14 | } | ||
15 | } | ||
16 | if (/^=head1 *NAME *$/) { | ||
17 | $name = 1; | ||
18 | } | ||
19 | } | ||
20 | |||
21 | print join("\n", @words),"\n"; | ||
22 | |||
diff --git a/src/lib/libcrypto/util/libeay.num b/src/lib/libcrypto/util/libeay.num index 7e5728495f..f5c8c0be8a 100644 --- a/src/lib/libcrypto/util/libeay.num +++ b/src/lib/libcrypto/util/libeay.num | |||
@@ -980,7 +980,7 @@ BN_mul_word 999 EXIST::FUNCTION: | |||
980 | BN_sub_word 1000 EXIST::FUNCTION: | 980 | BN_sub_word 1000 EXIST::FUNCTION: |
981 | BN_dec2bn 1001 EXIST::FUNCTION: | 981 | BN_dec2bn 1001 EXIST::FUNCTION: |
982 | BN_bn2dec 1002 EXIST::FUNCTION: | 982 | BN_bn2dec 1002 EXIST::FUNCTION: |
983 | BIO_ghbn_ctrl 1003 EXIST::FUNCTION: | 983 | BIO_ghbn_ctrl 1003 NOEXIST::FUNCTION: |
984 | CRYPTO_free_ex_data 1004 EXIST::FUNCTION: | 984 | CRYPTO_free_ex_data 1004 EXIST::FUNCTION: |
985 | CRYPTO_get_ex_data 1005 EXIST::FUNCTION: | 985 | CRYPTO_get_ex_data 1005 EXIST::FUNCTION: |
986 | CRYPTO_set_ex_data 1007 EXIST::FUNCTION: | 986 | CRYPTO_set_ex_data 1007 EXIST::FUNCTION: |
@@ -1881,72 +1881,72 @@ BIO_f_linebuffer 2463 EXIST:VMS:FUNCTION: | |||
1881 | BN_bntest_rand 2464 EXIST::FUNCTION: | 1881 | BN_bntest_rand 2464 EXIST::FUNCTION: |
1882 | OPENSSL_issetugid 2465 EXIST::FUNCTION: | 1882 | OPENSSL_issetugid 2465 EXIST::FUNCTION: |
1883 | BN_rand_range 2466 EXIST::FUNCTION: | 1883 | BN_rand_range 2466 EXIST::FUNCTION: |
1884 | ERR_load_ENGINE_strings 2467 EXIST::FUNCTION: | 1884 | ERR_load_ENGINE_strings 2467 EXIST::FUNCTION:ENGINE |
1885 | ENGINE_set_DSA 2468 EXIST::FUNCTION: | 1885 | ENGINE_set_DSA 2468 EXIST::FUNCTION:ENGINE |
1886 | ENGINE_get_finish_function 2469 EXIST::FUNCTION: | 1886 | ENGINE_get_finish_function 2469 EXIST::FUNCTION:ENGINE |
1887 | ENGINE_get_default_RSA 2470 EXIST::FUNCTION: | 1887 | ENGINE_get_default_RSA 2470 EXIST::FUNCTION:ENGINE |
1888 | ENGINE_get_BN_mod_exp 2471 NOEXIST::FUNCTION: | 1888 | ENGINE_get_BN_mod_exp 2471 NOEXIST::FUNCTION: |
1889 | DSA_get_default_openssl_method 2472 NOEXIST::FUNCTION: | 1889 | DSA_get_default_openssl_method 2472 NOEXIST::FUNCTION: |
1890 | ENGINE_set_DH 2473 EXIST::FUNCTION: | 1890 | ENGINE_set_DH 2473 EXIST::FUNCTION:ENGINE |
1891 | ENGINE_set_def_BN_mod_exp_crt 2474 NOEXIST::FUNCTION: | 1891 | ENGINE_set_def_BN_mod_exp_crt 2474 NOEXIST::FUNCTION: |
1892 | ENGINE_set_default_BN_mod_exp_crt 2474 NOEXIST::FUNCTION: | 1892 | ENGINE_set_default_BN_mod_exp_crt 2474 NOEXIST::FUNCTION: |
1893 | ENGINE_init 2475 EXIST::FUNCTION: | 1893 | ENGINE_init 2475 EXIST::FUNCTION:ENGINE |
1894 | DH_get_default_openssl_method 2476 NOEXIST::FUNCTION: | 1894 | DH_get_default_openssl_method 2476 NOEXIST::FUNCTION: |
1895 | RSA_set_default_openssl_method 2477 NOEXIST::FUNCTION: | 1895 | RSA_set_default_openssl_method 2477 NOEXIST::FUNCTION: |
1896 | ENGINE_finish 2478 EXIST::FUNCTION: | 1896 | ENGINE_finish 2478 EXIST::FUNCTION:ENGINE |
1897 | ENGINE_load_public_key 2479 EXIST::FUNCTION: | 1897 | ENGINE_load_public_key 2479 EXIST::FUNCTION:ENGINE |
1898 | ENGINE_get_DH 2480 EXIST::FUNCTION: | 1898 | ENGINE_get_DH 2480 EXIST::FUNCTION:ENGINE |
1899 | ENGINE_ctrl 2481 EXIST::FUNCTION: | 1899 | ENGINE_ctrl 2481 EXIST::FUNCTION:ENGINE |
1900 | ENGINE_get_init_function 2482 EXIST::FUNCTION: | 1900 | ENGINE_get_init_function 2482 EXIST::FUNCTION:ENGINE |
1901 | ENGINE_set_init_function 2483 EXIST::FUNCTION: | 1901 | ENGINE_set_init_function 2483 EXIST::FUNCTION:ENGINE |
1902 | ENGINE_set_default_DSA 2484 EXIST::FUNCTION: | 1902 | ENGINE_set_default_DSA 2484 EXIST::FUNCTION:ENGINE |
1903 | ENGINE_get_name 2485 EXIST::FUNCTION: | 1903 | ENGINE_get_name 2485 EXIST::FUNCTION:ENGINE |
1904 | ENGINE_get_last 2486 EXIST::FUNCTION: | 1904 | ENGINE_get_last 2486 EXIST::FUNCTION:ENGINE |
1905 | ENGINE_get_prev 2487 EXIST::FUNCTION: | 1905 | ENGINE_get_prev 2487 EXIST::FUNCTION:ENGINE |
1906 | ENGINE_get_default_DH 2488 EXIST::FUNCTION: | 1906 | ENGINE_get_default_DH 2488 EXIST::FUNCTION:ENGINE |
1907 | ENGINE_get_RSA 2489 EXIST::FUNCTION: | 1907 | ENGINE_get_RSA 2489 EXIST::FUNCTION:ENGINE |
1908 | ENGINE_set_default 2490 EXIST::FUNCTION: | 1908 | ENGINE_set_default 2490 EXIST::FUNCTION:ENGINE |
1909 | ENGINE_get_RAND 2491 EXIST::FUNCTION: | 1909 | ENGINE_get_RAND 2491 EXIST::FUNCTION:ENGINE |
1910 | ENGINE_get_first 2492 EXIST::FUNCTION: | 1910 | ENGINE_get_first 2492 EXIST::FUNCTION:ENGINE |
1911 | ENGINE_by_id 2493 EXIST::FUNCTION: | 1911 | ENGINE_by_id 2493 EXIST::FUNCTION:ENGINE |
1912 | ENGINE_set_finish_function 2494 EXIST::FUNCTION: | 1912 | ENGINE_set_finish_function 2494 EXIST::FUNCTION:ENGINE |
1913 | ENGINE_get_def_BN_mod_exp_crt 2495 NOEXIST::FUNCTION: | 1913 | ENGINE_get_def_BN_mod_exp_crt 2495 NOEXIST::FUNCTION: |
1914 | ENGINE_get_default_BN_mod_exp_crt 2495 NOEXIST::FUNCTION: | 1914 | ENGINE_get_default_BN_mod_exp_crt 2495 NOEXIST::FUNCTION: |
1915 | RSA_get_default_openssl_method 2496 NOEXIST::FUNCTION: | 1915 | RSA_get_default_openssl_method 2496 NOEXIST::FUNCTION: |
1916 | ENGINE_set_RSA 2497 EXIST::FUNCTION: | 1916 | ENGINE_set_RSA 2497 EXIST::FUNCTION:ENGINE |
1917 | ENGINE_load_private_key 2498 EXIST::FUNCTION: | 1917 | ENGINE_load_private_key 2498 EXIST::FUNCTION:ENGINE |
1918 | ENGINE_set_default_RAND 2499 EXIST::FUNCTION: | 1918 | ENGINE_set_default_RAND 2499 EXIST::FUNCTION:ENGINE |
1919 | ENGINE_set_BN_mod_exp 2500 NOEXIST::FUNCTION: | 1919 | ENGINE_set_BN_mod_exp 2500 NOEXIST::FUNCTION: |
1920 | ENGINE_remove 2501 EXIST::FUNCTION: | 1920 | ENGINE_remove 2501 EXIST::FUNCTION:ENGINE |
1921 | ENGINE_free 2502 EXIST::FUNCTION: | 1921 | ENGINE_free 2502 EXIST::FUNCTION:ENGINE |
1922 | ENGINE_get_BN_mod_exp_crt 2503 NOEXIST::FUNCTION: | 1922 | ENGINE_get_BN_mod_exp_crt 2503 NOEXIST::FUNCTION: |
1923 | ENGINE_get_next 2504 EXIST::FUNCTION: | 1923 | ENGINE_get_next 2504 EXIST::FUNCTION:ENGINE |
1924 | ENGINE_set_name 2505 EXIST::FUNCTION: | 1924 | ENGINE_set_name 2505 EXIST::FUNCTION:ENGINE |
1925 | ENGINE_get_default_DSA 2506 EXIST::FUNCTION: | 1925 | ENGINE_get_default_DSA 2506 EXIST::FUNCTION:ENGINE |
1926 | ENGINE_set_default_BN_mod_exp 2507 NOEXIST::FUNCTION: | 1926 | ENGINE_set_default_BN_mod_exp 2507 NOEXIST::FUNCTION: |
1927 | ENGINE_set_default_RSA 2508 EXIST::FUNCTION: | 1927 | ENGINE_set_default_RSA 2508 EXIST::FUNCTION:ENGINE |
1928 | ENGINE_get_default_RAND 2509 EXIST::FUNCTION: | 1928 | ENGINE_get_default_RAND 2509 EXIST::FUNCTION:ENGINE |
1929 | ENGINE_get_default_BN_mod_exp 2510 NOEXIST::FUNCTION: | 1929 | ENGINE_get_default_BN_mod_exp 2510 NOEXIST::FUNCTION: |
1930 | ENGINE_set_RAND 2511 EXIST::FUNCTION: | 1930 | ENGINE_set_RAND 2511 EXIST::FUNCTION:ENGINE |
1931 | ENGINE_set_id 2512 EXIST::FUNCTION: | 1931 | ENGINE_set_id 2512 EXIST::FUNCTION:ENGINE |
1932 | ENGINE_set_BN_mod_exp_crt 2513 NOEXIST::FUNCTION: | 1932 | ENGINE_set_BN_mod_exp_crt 2513 NOEXIST::FUNCTION: |
1933 | ENGINE_set_default_DH 2514 EXIST::FUNCTION: | 1933 | ENGINE_set_default_DH 2514 EXIST::FUNCTION:ENGINE |
1934 | ENGINE_new 2515 EXIST::FUNCTION: | 1934 | ENGINE_new 2515 EXIST::FUNCTION:ENGINE |
1935 | ENGINE_get_id 2516 EXIST::FUNCTION: | 1935 | ENGINE_get_id 2516 EXIST::FUNCTION:ENGINE |
1936 | DSA_set_default_openssl_method 2517 NOEXIST::FUNCTION: | 1936 | DSA_set_default_openssl_method 2517 NOEXIST::FUNCTION: |
1937 | ENGINE_add 2518 EXIST::FUNCTION: | 1937 | ENGINE_add 2518 EXIST::FUNCTION:ENGINE |
1938 | DH_set_default_openssl_method 2519 NOEXIST::FUNCTION: | 1938 | DH_set_default_openssl_method 2519 NOEXIST::FUNCTION: |
1939 | ENGINE_get_DSA 2520 EXIST::FUNCTION: | 1939 | ENGINE_get_DSA 2520 EXIST::FUNCTION:ENGINE |
1940 | ENGINE_get_ctrl_function 2521 EXIST::FUNCTION: | 1940 | ENGINE_get_ctrl_function 2521 EXIST::FUNCTION:ENGINE |
1941 | ENGINE_set_ctrl_function 2522 EXIST::FUNCTION: | 1941 | ENGINE_set_ctrl_function 2522 EXIST::FUNCTION:ENGINE |
1942 | BN_pseudo_rand_range 2523 EXIST::FUNCTION: | 1942 | BN_pseudo_rand_range 2523 EXIST::FUNCTION: |
1943 | X509_STORE_CTX_set_verify_cb 2524 EXIST::FUNCTION: | 1943 | X509_STORE_CTX_set_verify_cb 2524 EXIST::FUNCTION: |
1944 | ERR_load_COMP_strings 2525 EXIST::FUNCTION: | 1944 | ERR_load_COMP_strings 2525 EXIST::FUNCTION: |
1945 | PKCS12_item_decrypt_d2i 2526 EXIST::FUNCTION: | 1945 | PKCS12_item_decrypt_d2i 2526 EXIST::FUNCTION: |
1946 | ASN1_UTF8STRING_it 2527 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | 1946 | ASN1_UTF8STRING_it 2527 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: |
1947 | ASN1_UTF8STRING_it 2527 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | 1947 | ASN1_UTF8STRING_it 2527 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: |
1948 | ENGINE_unregister_ciphers 2528 EXIST::FUNCTION: | 1948 | ENGINE_unregister_ciphers 2528 EXIST::FUNCTION:ENGINE |
1949 | ENGINE_get_ciphers 2529 EXIST::FUNCTION: | 1949 | ENGINE_get_ciphers 2529 EXIST::FUNCTION:ENGINE |
1950 | d2i_OCSP_BASICRESP 2530 EXIST::FUNCTION: | 1950 | d2i_OCSP_BASICRESP 2530 EXIST::FUNCTION: |
1951 | KRB5_CHECKSUM_it 2531 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | 1951 | KRB5_CHECKSUM_it 2531 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: |
1952 | KRB5_CHECKSUM_it 2531 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | 1952 | KRB5_CHECKSUM_it 2531 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: |
@@ -1959,15 +1959,15 @@ X509V3_add1_i2d 2536 EXIST::FUNCTION: | |||
1959 | PKCS7_ENVELOPE_it 2537 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | 1959 | PKCS7_ENVELOPE_it 2537 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: |
1960 | PKCS7_ENVELOPE_it 2537 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | 1960 | PKCS7_ENVELOPE_it 2537 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: |
1961 | UI_add_input_boolean 2538 EXIST::FUNCTION: | 1961 | UI_add_input_boolean 2538 EXIST::FUNCTION: |
1962 | ENGINE_unregister_RSA 2539 EXIST::FUNCTION: | 1962 | ENGINE_unregister_RSA 2539 EXIST::FUNCTION:ENGINE |
1963 | X509V3_EXT_nconf 2540 EXIST::FUNCTION: | 1963 | X509V3_EXT_nconf 2540 EXIST::FUNCTION: |
1964 | ASN1_GENERALSTRING_free 2541 EXIST::FUNCTION: | 1964 | ASN1_GENERALSTRING_free 2541 EXIST::FUNCTION: |
1965 | d2i_OCSP_CERTSTATUS 2542 EXIST::FUNCTION: | 1965 | d2i_OCSP_CERTSTATUS 2542 EXIST::FUNCTION: |
1966 | X509_REVOKED_set_serialNumber 2543 EXIST::FUNCTION: | 1966 | X509_REVOKED_set_serialNumber 2543 EXIST::FUNCTION: |
1967 | X509_print_ex 2544 EXIST::FUNCTION:BIO | 1967 | X509_print_ex 2544 EXIST::FUNCTION:BIO |
1968 | OCSP_ONEREQ_get1_ext_d2i 2545 EXIST::FUNCTION: | 1968 | OCSP_ONEREQ_get1_ext_d2i 2545 EXIST::FUNCTION: |
1969 | ENGINE_register_all_RAND 2546 EXIST::FUNCTION: | 1969 | ENGINE_register_all_RAND 2546 EXIST::FUNCTION:ENGINE |
1970 | ENGINE_load_dynamic 2547 EXIST::FUNCTION: | 1970 | ENGINE_load_dynamic 2547 EXIST::FUNCTION:ENGINE |
1971 | PBKDF2PARAM_it 2548 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | 1971 | PBKDF2PARAM_it 2548 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: |
1972 | PBKDF2PARAM_it 2548 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | 1972 | PBKDF2PARAM_it 2548 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: |
1973 | EXTENDED_KEY_USAGE_new 2549 EXIST::FUNCTION: | 1973 | EXTENDED_KEY_USAGE_new 2549 EXIST::FUNCTION: |
@@ -1987,7 +1987,7 @@ X509_STORE_set_purpose 2559 EXIST::FUNCTION: | |||
1987 | i2d_ASN1_GENERALSTRING 2560 EXIST::FUNCTION: | 1987 | i2d_ASN1_GENERALSTRING 2560 EXIST::FUNCTION: |
1988 | OCSP_response_status 2561 EXIST::FUNCTION: | 1988 | OCSP_response_status 2561 EXIST::FUNCTION: |
1989 | i2d_OCSP_SERVICELOC 2562 EXIST::FUNCTION: | 1989 | i2d_OCSP_SERVICELOC 2562 EXIST::FUNCTION: |
1990 | ENGINE_get_digest_engine 2563 EXIST::FUNCTION: | 1990 | ENGINE_get_digest_engine 2563 EXIST::FUNCTION:ENGINE |
1991 | EC_GROUP_set_curve_GFp 2564 EXIST::FUNCTION:EC | 1991 | EC_GROUP_set_curve_GFp 2564 EXIST::FUNCTION:EC |
1992 | OCSP_REQUEST_get_ext_by_OBJ 2565 EXIST::FUNCTION: | 1992 | OCSP_REQUEST_get_ext_by_OBJ 2565 EXIST::FUNCTION: |
1993 | _ossl_old_des_random_key 2566 EXIST::FUNCTION:DES | 1993 | _ossl_old_des_random_key 2566 EXIST::FUNCTION:DES |
@@ -2011,7 +2011,7 @@ _shadow_DES_rw_mode 2581 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIA | |||
2011 | _shadow_DES_rw_mode 2581 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:DES | 2011 | _shadow_DES_rw_mode 2581 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:DES |
2012 | asn1_do_adb 2582 EXIST::FUNCTION: | 2012 | asn1_do_adb 2582 EXIST::FUNCTION: |
2013 | ASN1_template_i2d 2583 EXIST::FUNCTION: | 2013 | ASN1_template_i2d 2583 EXIST::FUNCTION: |
2014 | ENGINE_register_DH 2584 EXIST::FUNCTION: | 2014 | ENGINE_register_DH 2584 EXIST::FUNCTION:ENGINE |
2015 | UI_construct_prompt 2585 EXIST::FUNCTION: | 2015 | UI_construct_prompt 2585 EXIST::FUNCTION: |
2016 | X509_STORE_set_trust 2586 EXIST::FUNCTION: | 2016 | X509_STORE_set_trust 2586 EXIST::FUNCTION: |
2017 | UI_dup_input_string 2587 EXIST::FUNCTION: | 2017 | UI_dup_input_string 2587 EXIST::FUNCTION: |
@@ -2039,7 +2039,7 @@ OCSP_resp_find 2605 EXIST::FUNCTION: | |||
2039 | BN_nnmod 2606 EXIST::FUNCTION: | 2039 | BN_nnmod 2606 EXIST::FUNCTION: |
2040 | X509_CRL_sort 2607 EXIST::FUNCTION: | 2040 | X509_CRL_sort 2607 EXIST::FUNCTION: |
2041 | X509_REVOKED_set_revocationDate 2608 EXIST::FUNCTION: | 2041 | X509_REVOKED_set_revocationDate 2608 EXIST::FUNCTION: |
2042 | ENGINE_register_RAND 2609 EXIST::FUNCTION: | 2042 | ENGINE_register_RAND 2609 EXIST::FUNCTION:ENGINE |
2043 | OCSP_SERVICELOC_new 2610 EXIST::FUNCTION: | 2043 | OCSP_SERVICELOC_new 2610 EXIST::FUNCTION: |
2044 | EC_POINT_set_affine_coordinates_GFp 2611 EXIST:!VMS:FUNCTION:EC | 2044 | EC_POINT_set_affine_coordinates_GFp 2611 EXIST:!VMS:FUNCTION:EC |
2045 | EC_POINT_set_affine_coords_GFp 2611 EXIST:VMS:FUNCTION:EC | 2045 | EC_POINT_set_affine_coords_GFp 2611 EXIST:VMS:FUNCTION:EC |
@@ -2049,11 +2049,11 @@ SXNET_it 2613 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTI | |||
2049 | UI_dup_input_boolean 2614 EXIST::FUNCTION: | 2049 | UI_dup_input_boolean 2614 EXIST::FUNCTION: |
2050 | PKCS12_add_CSPName_asc 2615 EXIST::FUNCTION: | 2050 | PKCS12_add_CSPName_asc 2615 EXIST::FUNCTION: |
2051 | EC_POINT_is_at_infinity 2616 EXIST::FUNCTION:EC | 2051 | EC_POINT_is_at_infinity 2616 EXIST::FUNCTION:EC |
2052 | ENGINE_load_openbsd_dev_crypto 2617 EXIST::FUNCTION: | 2052 | ENGINE_load_cryptodev 2617 EXIST::FUNCTION:ENGINE |
2053 | DSO_convert_filename 2618 EXIST::FUNCTION: | 2053 | DSO_convert_filename 2618 EXIST::FUNCTION: |
2054 | POLICYQUALINFO_it 2619 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | 2054 | POLICYQUALINFO_it 2619 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: |
2055 | POLICYQUALINFO_it 2619 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | 2055 | POLICYQUALINFO_it 2619 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: |
2056 | ENGINE_register_ciphers 2620 EXIST::FUNCTION: | 2056 | ENGINE_register_ciphers 2620 EXIST::FUNCTION:ENGINE |
2057 | BN_mod_lshift_quick 2621 EXIST::FUNCTION: | 2057 | BN_mod_lshift_quick 2621 EXIST::FUNCTION: |
2058 | DSO_set_filename 2622 EXIST::FUNCTION: | 2058 | DSO_set_filename 2622 EXIST::FUNCTION: |
2059 | ASN1_item_free 2623 EXIST::FUNCTION: | 2059 | ASN1_item_free 2623 EXIST::FUNCTION: |
@@ -2062,7 +2062,7 @@ AUTHORITY_KEYID_it 2625 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIA | |||
2062 | AUTHORITY_KEYID_it 2625 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | 2062 | AUTHORITY_KEYID_it 2625 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: |
2063 | KRB5_APREQBODY_new 2626 EXIST::FUNCTION: | 2063 | KRB5_APREQBODY_new 2626 EXIST::FUNCTION: |
2064 | X509V3_EXT_REQ_add_nconf 2627 EXIST::FUNCTION: | 2064 | X509V3_EXT_REQ_add_nconf 2627 EXIST::FUNCTION: |
2065 | ENGINE_ctrl_cmd_string 2628 EXIST::FUNCTION: | 2065 | ENGINE_ctrl_cmd_string 2628 EXIST::FUNCTION:ENGINE |
2066 | i2d_OCSP_RESPDATA 2629 EXIST::FUNCTION: | 2066 | i2d_OCSP_RESPDATA 2629 EXIST::FUNCTION: |
2067 | EVP_MD_CTX_init 2630 EXIST::FUNCTION: | 2067 | EVP_MD_CTX_init 2630 EXIST::FUNCTION: |
2068 | EXTENDED_KEY_USAGE_free 2631 EXIST::FUNCTION: | 2068 | EXTENDED_KEY_USAGE_free 2631 EXIST::FUNCTION: |
@@ -2071,8 +2071,8 @@ PKCS7_ATTR_SIGN_it 2632 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTI | |||
2071 | UI_add_error_string 2633 EXIST::FUNCTION: | 2071 | UI_add_error_string 2633 EXIST::FUNCTION: |
2072 | KRB5_CHECKSUM_free 2634 EXIST::FUNCTION: | 2072 | KRB5_CHECKSUM_free 2634 EXIST::FUNCTION: |
2073 | OCSP_REQUEST_get_ext 2635 EXIST::FUNCTION: | 2073 | OCSP_REQUEST_get_ext 2635 EXIST::FUNCTION: |
2074 | ENGINE_load_ubsec 2636 EXIST::FUNCTION: | 2074 | ENGINE_load_ubsec 2636 EXIST::FUNCTION:ENGINE |
2075 | ENGINE_register_all_digests 2637 EXIST::FUNCTION: | 2075 | ENGINE_register_all_digests 2637 EXIST::FUNCTION:ENGINE |
2076 | PKEY_USAGE_PERIOD_it 2638 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | 2076 | PKEY_USAGE_PERIOD_it 2638 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: |
2077 | PKEY_USAGE_PERIOD_it 2638 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | 2077 | PKEY_USAGE_PERIOD_it 2638 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: |
2078 | PKCS12_unpack_authsafes 2639 EXIST::FUNCTION: | 2078 | PKCS12_unpack_authsafes 2639 EXIST::FUNCTION: |
@@ -2098,16 +2098,16 @@ OCSP_CERTSTATUS_free 2653 EXIST::FUNCTION: | |||
2098 | _ossl_old_des_crypt 2654 EXIST::FUNCTION:DES | 2098 | _ossl_old_des_crypt 2654 EXIST::FUNCTION:DES |
2099 | ASN1_item_i2d 2655 EXIST::FUNCTION: | 2099 | ASN1_item_i2d 2655 EXIST::FUNCTION: |
2100 | EVP_DecryptFinal_ex 2656 EXIST::FUNCTION: | 2100 | EVP_DecryptFinal_ex 2656 EXIST::FUNCTION: |
2101 | ENGINE_load_openssl 2657 EXIST::FUNCTION: | 2101 | ENGINE_load_openssl 2657 EXIST::FUNCTION:ENGINE |
2102 | ENGINE_get_cmd_defns 2658 EXIST::FUNCTION: | 2102 | ENGINE_get_cmd_defns 2658 EXIST::FUNCTION:ENGINE |
2103 | ENGINE_set_load_privkey_function 2659 EXIST:!VMS:FUNCTION: | 2103 | ENGINE_set_load_privkey_function 2659 EXIST:!VMS:FUNCTION:ENGINE |
2104 | ENGINE_set_load_privkey_fn 2659 EXIST:VMS:FUNCTION: | 2104 | ENGINE_set_load_privkey_fn 2659 EXIST:VMS:FUNCTION:ENGINE |
2105 | EVP_EncryptFinal_ex 2660 EXIST::FUNCTION: | 2105 | EVP_EncryptFinal_ex 2660 EXIST::FUNCTION: |
2106 | ENGINE_set_default_digests 2661 EXIST::FUNCTION: | 2106 | ENGINE_set_default_digests 2661 EXIST::FUNCTION:ENGINE |
2107 | X509_get0_pubkey_bitstr 2662 EXIST::FUNCTION: | 2107 | X509_get0_pubkey_bitstr 2662 EXIST::FUNCTION: |
2108 | asn1_ex_i2c 2663 EXIST::FUNCTION: | 2108 | asn1_ex_i2c 2663 EXIST::FUNCTION: |
2109 | ENGINE_register_RSA 2664 EXIST::FUNCTION: | 2109 | ENGINE_register_RSA 2664 EXIST::FUNCTION:ENGINE |
2110 | ENGINE_unregister_DSA 2665 EXIST::FUNCTION: | 2110 | ENGINE_unregister_DSA 2665 EXIST::FUNCTION:ENGINE |
2111 | _ossl_old_des_key_sched 2666 EXIST::FUNCTION:DES | 2111 | _ossl_old_des_key_sched 2666 EXIST::FUNCTION:DES |
2112 | X509_EXTENSION_it 2667 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | 2112 | X509_EXTENSION_it 2667 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: |
2113 | X509_EXTENSION_it 2667 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | 2113 | X509_EXTENSION_it 2667 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: |
@@ -2120,7 +2120,7 @@ PKCS12_certbag2x509 2672 EXIST::FUNCTION: | |||
2120 | _ossl_old_des_ofb64_encrypt 2673 EXIST::FUNCTION:DES | 2120 | _ossl_old_des_ofb64_encrypt 2673 EXIST::FUNCTION:DES |
2121 | d2i_EXTENDED_KEY_USAGE 2674 EXIST::FUNCTION: | 2121 | d2i_EXTENDED_KEY_USAGE 2674 EXIST::FUNCTION: |
2122 | ERR_print_errors_cb 2675 EXIST::FUNCTION: | 2122 | ERR_print_errors_cb 2675 EXIST::FUNCTION: |
2123 | ENGINE_set_ciphers 2676 EXIST::FUNCTION: | 2123 | ENGINE_set_ciphers 2676 EXIST::FUNCTION:ENGINE |
2124 | d2i_KRB5_APREQBODY 2677 EXIST::FUNCTION: | 2124 | d2i_KRB5_APREQBODY 2677 EXIST::FUNCTION: |
2125 | UI_method_get_flusher 2678 EXIST::FUNCTION: | 2125 | UI_method_get_flusher 2678 EXIST::FUNCTION: |
2126 | X509_PUBKEY_it 2679 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | 2126 | X509_PUBKEY_it 2679 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: |
@@ -2156,7 +2156,7 @@ NCONF_get_number_e 2704 EXIST::FUNCTION: | |||
2156 | _ossl_old_des_decrypt3 2705 EXIST::FUNCTION:DES | 2156 | _ossl_old_des_decrypt3 2705 EXIST::FUNCTION:DES |
2157 | X509_signature_print 2706 EXIST::FUNCTION:EVP | 2157 | X509_signature_print 2706 EXIST::FUNCTION:EVP |
2158 | OCSP_SINGLERESP_free 2707 EXIST::FUNCTION: | 2158 | OCSP_SINGLERESP_free 2707 EXIST::FUNCTION: |
2159 | ENGINE_load_builtin_engines 2708 EXIST::FUNCTION: | 2159 | ENGINE_load_builtin_engines 2708 EXIST::FUNCTION:ENGINE |
2160 | i2d_OCSP_ONEREQ 2709 EXIST::FUNCTION: | 2160 | i2d_OCSP_ONEREQ 2709 EXIST::FUNCTION: |
2161 | OCSP_REQUEST_add_ext 2710 EXIST::FUNCTION: | 2161 | OCSP_REQUEST_add_ext 2710 EXIST::FUNCTION: |
2162 | OCSP_RESPBYTES_new 2711 EXIST::FUNCTION: | 2162 | OCSP_RESPBYTES_new 2711 EXIST::FUNCTION: |
@@ -2184,7 +2184,7 @@ X509_CERT_AUX_it 2727 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTI | |||
2184 | CERTIFICATEPOLICIES_it 2728 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | 2184 | CERTIFICATEPOLICIES_it 2728 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: |
2185 | CERTIFICATEPOLICIES_it 2728 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | 2185 | CERTIFICATEPOLICIES_it 2728 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: |
2186 | _ossl_old_des_ede3_cbc_encrypt 2729 EXIST::FUNCTION:DES | 2186 | _ossl_old_des_ede3_cbc_encrypt 2729 EXIST::FUNCTION:DES |
2187 | RAND_set_rand_engine 2730 EXIST::FUNCTION: | 2187 | RAND_set_rand_engine 2730 EXIST::FUNCTION:ENGINE |
2188 | DSO_get_loaded_filename 2731 EXIST::FUNCTION: | 2188 | DSO_get_loaded_filename 2731 EXIST::FUNCTION: |
2189 | X509_ATTRIBUTE_it 2732 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | 2189 | X509_ATTRIBUTE_it 2732 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: |
2190 | X509_ATTRIBUTE_it 2732 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | 2190 | X509_ATTRIBUTE_it 2732 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: |
@@ -2206,7 +2206,7 @@ i2d_OCSP_BASICRESP 2744 EXIST::FUNCTION: | |||
2206 | i2d_OCSP_RESPBYTES 2745 EXIST::FUNCTION: | 2206 | i2d_OCSP_RESPBYTES 2745 EXIST::FUNCTION: |
2207 | PKCS12_unpack_p7encdata 2746 EXIST::FUNCTION: | 2207 | PKCS12_unpack_p7encdata 2746 EXIST::FUNCTION: |
2208 | HMAC_CTX_init 2747 EXIST::FUNCTION:HMAC | 2208 | HMAC_CTX_init 2747 EXIST::FUNCTION:HMAC |
2209 | ENGINE_get_digest 2748 EXIST::FUNCTION: | 2209 | ENGINE_get_digest 2748 EXIST::FUNCTION:ENGINE |
2210 | OCSP_RESPONSE_print 2749 EXIST::FUNCTION: | 2210 | OCSP_RESPONSE_print 2749 EXIST::FUNCTION: |
2211 | KRB5_TKTBODY_it 2750 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | 2211 | KRB5_TKTBODY_it 2750 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: |
2212 | KRB5_TKTBODY_it 2750 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | 2212 | KRB5_TKTBODY_it 2750 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: |
@@ -2219,16 +2219,16 @@ PBE2PARAM_it 2753 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTI | |||
2219 | PKCS12_certbag2x509crl 2754 EXIST::FUNCTION: | 2219 | PKCS12_certbag2x509crl 2754 EXIST::FUNCTION: |
2220 | PKCS7_SIGNED_it 2755 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | 2220 | PKCS7_SIGNED_it 2755 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: |
2221 | PKCS7_SIGNED_it 2755 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | 2221 | PKCS7_SIGNED_it 2755 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: |
2222 | ENGINE_get_cipher 2756 EXIST::FUNCTION: | 2222 | ENGINE_get_cipher 2756 EXIST::FUNCTION:ENGINE |
2223 | i2d_OCSP_CRLID 2757 EXIST::FUNCTION: | 2223 | i2d_OCSP_CRLID 2757 EXIST::FUNCTION: |
2224 | OCSP_SINGLERESP_new 2758 EXIST::FUNCTION: | 2224 | OCSP_SINGLERESP_new 2758 EXIST::FUNCTION: |
2225 | ENGINE_cmd_is_executable 2759 EXIST::FUNCTION: | 2225 | ENGINE_cmd_is_executable 2759 EXIST::FUNCTION:ENGINE |
2226 | RSA_up_ref 2760 EXIST::FUNCTION:RSA | 2226 | RSA_up_ref 2760 EXIST::FUNCTION:RSA |
2227 | ASN1_GENERALSTRING_it 2761 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | 2227 | ASN1_GENERALSTRING_it 2761 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: |
2228 | ASN1_GENERALSTRING_it 2761 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | 2228 | ASN1_GENERALSTRING_it 2761 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: |
2229 | ENGINE_register_DSA 2762 EXIST::FUNCTION: | 2229 | ENGINE_register_DSA 2762 EXIST::FUNCTION:ENGINE |
2230 | X509V3_EXT_add_nconf_sk 2763 EXIST::FUNCTION: | 2230 | X509V3_EXT_add_nconf_sk 2763 EXIST::FUNCTION: |
2231 | ENGINE_set_load_pubkey_function 2764 EXIST::FUNCTION: | 2231 | ENGINE_set_load_pubkey_function 2764 EXIST::FUNCTION:ENGINE |
2232 | PKCS8_decrypt 2765 EXIST::FUNCTION: | 2232 | PKCS8_decrypt 2765 EXIST::FUNCTION: |
2233 | PEM_bytes_read_bio 2766 EXIST::FUNCTION:BIO | 2233 | PEM_bytes_read_bio 2766 EXIST::FUNCTION:BIO |
2234 | DIRECTORYSTRING_it 2767 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | 2234 | DIRECTORYSTRING_it 2767 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: |
@@ -2265,7 +2265,7 @@ UI_method_set_flusher 2789 EXIST::FUNCTION: | |||
2265 | X509_ocspid_print 2790 EXIST::FUNCTION:BIO | 2265 | X509_ocspid_print 2790 EXIST::FUNCTION:BIO |
2266 | KRB5_ENCDATA_it 2791 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | 2266 | KRB5_ENCDATA_it 2791 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: |
2267 | KRB5_ENCDATA_it 2791 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | 2267 | KRB5_ENCDATA_it 2791 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: |
2268 | ENGINE_get_load_pubkey_function 2792 EXIST::FUNCTION: | 2268 | ENGINE_get_load_pubkey_function 2792 EXIST::FUNCTION:ENGINE |
2269 | UI_add_user_data 2793 EXIST::FUNCTION: | 2269 | UI_add_user_data 2793 EXIST::FUNCTION: |
2270 | OCSP_REQUEST_delete_ext 2794 EXIST::FUNCTION: | 2270 | OCSP_REQUEST_delete_ext 2794 EXIST::FUNCTION: |
2271 | UI_get_method 2795 EXIST::FUNCTION: | 2271 | UI_get_method 2795 EXIST::FUNCTION: |
@@ -2289,16 +2289,16 @@ ASN1_FBOOLEAN_it 2806 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIA | |||
2289 | ASN1_FBOOLEAN_it 2806 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | 2289 | ASN1_FBOOLEAN_it 2806 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: |
2290 | UI_set_ex_data 2807 EXIST::FUNCTION: | 2290 | UI_set_ex_data 2807 EXIST::FUNCTION: |
2291 | _ossl_old_des_string_to_key 2808 EXIST::FUNCTION:DES | 2291 | _ossl_old_des_string_to_key 2808 EXIST::FUNCTION:DES |
2292 | ENGINE_register_all_RSA 2809 EXIST::FUNCTION: | 2292 | ENGINE_register_all_RSA 2809 EXIST::FUNCTION:ENGINE |
2293 | d2i_KRB5_PRINCNAME 2810 EXIST::FUNCTION: | 2293 | d2i_KRB5_PRINCNAME 2810 EXIST::FUNCTION: |
2294 | OCSP_RESPBYTES_it 2811 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | 2294 | OCSP_RESPBYTES_it 2811 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: |
2295 | OCSP_RESPBYTES_it 2811 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | 2295 | OCSP_RESPBYTES_it 2811 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: |
2296 | X509_CINF_it 2812 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | 2296 | X509_CINF_it 2812 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: |
2297 | X509_CINF_it 2812 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | 2297 | X509_CINF_it 2812 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: |
2298 | ENGINE_unregister_digests 2813 EXIST::FUNCTION: | 2298 | ENGINE_unregister_digests 2813 EXIST::FUNCTION:ENGINE |
2299 | d2i_EDIPARTYNAME 2814 EXIST::FUNCTION: | 2299 | d2i_EDIPARTYNAME 2814 EXIST::FUNCTION: |
2300 | d2i_OCSP_SERVICELOC 2815 EXIST::FUNCTION: | 2300 | d2i_OCSP_SERVICELOC 2815 EXIST::FUNCTION: |
2301 | ENGINE_get_digests 2816 EXIST::FUNCTION: | 2301 | ENGINE_get_digests 2816 EXIST::FUNCTION:ENGINE |
2302 | _ossl_old_des_set_odd_parity 2817 EXIST::FUNCTION:DES | 2302 | _ossl_old_des_set_odd_parity 2817 EXIST::FUNCTION:DES |
2303 | OCSP_RESPDATA_free 2818 EXIST::FUNCTION: | 2303 | OCSP_RESPDATA_free 2818 EXIST::FUNCTION: |
2304 | d2i_KRB5_TICKET 2819 EXIST::FUNCTION: | 2304 | d2i_KRB5_TICKET 2819 EXIST::FUNCTION: |
@@ -2309,7 +2309,7 @@ d2i_ASN1_GENERALSTRING 2822 EXIST::FUNCTION: | |||
2309 | X509_CRL_set_version 2823 EXIST::FUNCTION: | 2309 | X509_CRL_set_version 2823 EXIST::FUNCTION: |
2310 | BN_mod_sub 2824 EXIST::FUNCTION: | 2310 | BN_mod_sub 2824 EXIST::FUNCTION: |
2311 | OCSP_SINGLERESP_get_ext_by_NID 2825 EXIST::FUNCTION: | 2311 | OCSP_SINGLERESP_get_ext_by_NID 2825 EXIST::FUNCTION: |
2312 | ENGINE_get_ex_new_index 2826 EXIST::FUNCTION: | 2312 | ENGINE_get_ex_new_index 2826 EXIST::FUNCTION:ENGINE |
2313 | OCSP_REQUEST_free 2827 EXIST::FUNCTION: | 2313 | OCSP_REQUEST_free 2827 EXIST::FUNCTION: |
2314 | OCSP_REQUEST_add1_ext_i2d 2828 EXIST::FUNCTION: | 2314 | OCSP_REQUEST_add1_ext_i2d 2828 EXIST::FUNCTION: |
2315 | X509_VAL_it 2829 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | 2315 | X509_VAL_it 2829 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: |
@@ -2343,7 +2343,7 @@ EC_POINT_method_of 2852 EXIST::FUNCTION:EC | |||
2343 | i2d_KRB5_APREQBODY 2853 EXIST::FUNCTION: | 2343 | i2d_KRB5_APREQBODY 2853 EXIST::FUNCTION: |
2344 | _ossl_old_des_ecb3_encrypt 2854 EXIST::FUNCTION:DES | 2344 | _ossl_old_des_ecb3_encrypt 2854 EXIST::FUNCTION:DES |
2345 | CRYPTO_get_mem_ex_functions 2855 EXIST::FUNCTION: | 2345 | CRYPTO_get_mem_ex_functions 2855 EXIST::FUNCTION: |
2346 | ENGINE_get_ex_data 2856 EXIST::FUNCTION: | 2346 | ENGINE_get_ex_data 2856 EXIST::FUNCTION:ENGINE |
2347 | UI_destroy_method 2857 EXIST::FUNCTION: | 2347 | UI_destroy_method 2857 EXIST::FUNCTION: |
2348 | ASN1_item_i2d_bio 2858 EXIST::FUNCTION:BIO | 2348 | ASN1_item_i2d_bio 2858 EXIST::FUNCTION:BIO |
2349 | OCSP_ONEREQ_get_ext_by_OBJ 2859 EXIST::FUNCTION: | 2349 | OCSP_ONEREQ_get_ext_by_OBJ 2859 EXIST::FUNCTION: |
@@ -2367,7 +2367,7 @@ PKCS12_SAFEBAGS_it 2872 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIA | |||
2367 | PKCS12_SAFEBAGS_it 2872 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | 2367 | PKCS12_SAFEBAGS_it 2872 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: |
2368 | d2i_OCSP_SIGNATURE 2873 EXIST::FUNCTION: | 2368 | d2i_OCSP_SIGNATURE 2873 EXIST::FUNCTION: |
2369 | OCSP_request_add1_nonce 2874 EXIST::FUNCTION: | 2369 | OCSP_request_add1_nonce 2874 EXIST::FUNCTION: |
2370 | ENGINE_set_cmd_defns 2875 EXIST::FUNCTION: | 2370 | ENGINE_set_cmd_defns 2875 EXIST::FUNCTION:ENGINE |
2371 | OCSP_SERVICELOC_free 2876 EXIST::FUNCTION: | 2371 | OCSP_SERVICELOC_free 2876 EXIST::FUNCTION: |
2372 | EC_GROUP_free 2877 EXIST::FUNCTION:EC | 2372 | EC_GROUP_free 2877 EXIST::FUNCTION:EC |
2373 | ASN1_BIT_STRING_it 2878 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | 2373 | ASN1_BIT_STRING_it 2878 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: |
@@ -2384,7 +2384,7 @@ EC_GROUP_new_curve_GFp 2885 EXIST::FUNCTION:EC | |||
2384 | OCSP_REQUEST_get1_ext_d2i 2886 EXIST::FUNCTION: | 2384 | OCSP_REQUEST_get1_ext_d2i 2886 EXIST::FUNCTION: |
2385 | PKCS12_item_pack_safebag 2887 EXIST::FUNCTION: | 2385 | PKCS12_item_pack_safebag 2887 EXIST::FUNCTION: |
2386 | asn1_ex_c2i 2888 EXIST::FUNCTION: | 2386 | asn1_ex_c2i 2888 EXIST::FUNCTION: |
2387 | ENGINE_register_digests 2889 EXIST::FUNCTION: | 2387 | ENGINE_register_digests 2889 EXIST::FUNCTION:ENGINE |
2388 | i2d_OCSP_REVOKEDINFO 2890 EXIST::FUNCTION: | 2388 | i2d_OCSP_REVOKEDINFO 2890 EXIST::FUNCTION: |
2389 | asn1_enc_restore 2891 EXIST::FUNCTION: | 2389 | asn1_enc_restore 2891 EXIST::FUNCTION: |
2390 | UI_free 2892 EXIST::FUNCTION: | 2390 | UI_free 2892 EXIST::FUNCTION: |
@@ -2395,7 +2395,7 @@ EC_POINT_invert 2896 EXIST::FUNCTION:EC | |||
2395 | OCSP_basic_sign 2897 EXIST::FUNCTION: | 2395 | OCSP_basic_sign 2897 EXIST::FUNCTION: |
2396 | i2d_OCSP_RESPID 2898 EXIST::FUNCTION: | 2396 | i2d_OCSP_RESPID 2898 EXIST::FUNCTION: |
2397 | OCSP_check_nonce 2899 EXIST::FUNCTION: | 2397 | OCSP_check_nonce 2899 EXIST::FUNCTION: |
2398 | ENGINE_ctrl_cmd 2900 EXIST::FUNCTION: | 2398 | ENGINE_ctrl_cmd 2900 EXIST::FUNCTION:ENGINE |
2399 | d2i_KRB5_ENCKEY 2901 EXIST::FUNCTION: | 2399 | d2i_KRB5_ENCKEY 2901 EXIST::FUNCTION: |
2400 | OCSP_parse_url 2902 EXIST::FUNCTION: | 2400 | OCSP_parse_url 2902 EXIST::FUNCTION: |
2401 | OCSP_SINGLERESP_get_ext 2903 EXIST::FUNCTION: | 2401 | OCSP_SINGLERESP_get_ext 2903 EXIST::FUNCTION: |
@@ -2403,12 +2403,12 @@ OCSP_CRLID_free 2904 EXIST::FUNCTION: | |||
2403 | OCSP_BASICRESP_get1_ext_d2i 2905 EXIST::FUNCTION: | 2403 | OCSP_BASICRESP_get1_ext_d2i 2905 EXIST::FUNCTION: |
2404 | RSAPrivateKey_it 2906 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:RSA | 2404 | RSAPrivateKey_it 2906 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:RSA |
2405 | RSAPrivateKey_it 2906 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:RSA | 2405 | RSAPrivateKey_it 2906 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:RSA |
2406 | ENGINE_register_all_DH 2907 EXIST::FUNCTION: | 2406 | ENGINE_register_all_DH 2907 EXIST::FUNCTION:ENGINE |
2407 | i2d_EDIPARTYNAME 2908 EXIST::FUNCTION: | 2407 | i2d_EDIPARTYNAME 2908 EXIST::FUNCTION: |
2408 | EC_POINT_get_affine_coordinates_GFp 2909 EXIST:!VMS:FUNCTION:EC | 2408 | EC_POINT_get_affine_coordinates_GFp 2909 EXIST:!VMS:FUNCTION:EC |
2409 | EC_POINT_get_affine_coords_GFp 2909 EXIST:VMS:FUNCTION:EC | 2409 | EC_POINT_get_affine_coords_GFp 2909 EXIST:VMS:FUNCTION:EC |
2410 | OCSP_CRLID_new 2910 EXIST::FUNCTION: | 2410 | OCSP_CRLID_new 2910 EXIST::FUNCTION: |
2411 | ENGINE_get_flags 2911 EXIST::FUNCTION: | 2411 | ENGINE_get_flags 2911 EXIST::FUNCTION:ENGINE |
2412 | OCSP_ONEREQ_it 2912 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | 2412 | OCSP_ONEREQ_it 2912 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: |
2413 | OCSP_ONEREQ_it 2912 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | 2413 | OCSP_ONEREQ_it 2912 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: |
2414 | UI_process 2913 EXIST::FUNCTION: | 2414 | UI_process 2913 EXIST::FUNCTION: |
@@ -2416,8 +2416,8 @@ ASN1_INTEGER_it 2914 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIA | |||
2416 | ASN1_INTEGER_it 2914 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | 2416 | ASN1_INTEGER_it 2914 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: |
2417 | EVP_CipherInit_ex 2915 EXIST::FUNCTION: | 2417 | EVP_CipherInit_ex 2915 EXIST::FUNCTION: |
2418 | UI_get_string_type 2916 EXIST::FUNCTION: | 2418 | UI_get_string_type 2916 EXIST::FUNCTION: |
2419 | ENGINE_unregister_DH 2917 EXIST::FUNCTION: | 2419 | ENGINE_unregister_DH 2917 EXIST::FUNCTION:ENGINE |
2420 | ENGINE_register_all_DSA 2918 EXIST::FUNCTION: | 2420 | ENGINE_register_all_DSA 2918 EXIST::FUNCTION:ENGINE |
2421 | OCSP_ONEREQ_get_ext_by_critical 2919 EXIST::FUNCTION: | 2421 | OCSP_ONEREQ_get_ext_by_critical 2919 EXIST::FUNCTION: |
2422 | bn_dup_expand 2920 EXIST::FUNCTION: | 2422 | bn_dup_expand 2920 EXIST::FUNCTION: |
2423 | OCSP_cert_id_new 2921 EXIST::FUNCTION: | 2423 | OCSP_cert_id_new 2921 EXIST::FUNCTION: |
@@ -2438,11 +2438,11 @@ BN_mod_sub_quick 2933 EXIST::FUNCTION: | |||
2438 | OCSP_ONEREQ_add_ext 2934 EXIST::FUNCTION: | 2438 | OCSP_ONEREQ_add_ext 2934 EXIST::FUNCTION: |
2439 | OCSP_request_sign 2935 EXIST::FUNCTION: | 2439 | OCSP_request_sign 2935 EXIST::FUNCTION: |
2440 | EVP_DigestFinal_ex 2936 EXIST::FUNCTION: | 2440 | EVP_DigestFinal_ex 2936 EXIST::FUNCTION: |
2441 | ENGINE_set_digests 2937 EXIST::FUNCTION: | 2441 | ENGINE_set_digests 2937 EXIST::FUNCTION:ENGINE |
2442 | OCSP_id_issuer_cmp 2938 EXIST::FUNCTION: | 2442 | OCSP_id_issuer_cmp 2938 EXIST::FUNCTION: |
2443 | OBJ_NAME_do_all 2939 EXIST::FUNCTION: | 2443 | OBJ_NAME_do_all 2939 EXIST::FUNCTION: |
2444 | EC_POINTs_mul 2940 EXIST::FUNCTION:EC | 2444 | EC_POINTs_mul 2940 EXIST::FUNCTION:EC |
2445 | ENGINE_register_complete 2941 EXIST::FUNCTION: | 2445 | ENGINE_register_complete 2941 EXIST::FUNCTION:ENGINE |
2446 | X509V3_EXT_nconf_nid 2942 EXIST::FUNCTION: | 2446 | X509V3_EXT_nconf_nid 2942 EXIST::FUNCTION: |
2447 | ASN1_SEQUENCE_it 2943 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | 2447 | ASN1_SEQUENCE_it 2943 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: |
2448 | ASN1_SEQUENCE_it 2943 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | 2448 | ASN1_SEQUENCE_it 2943 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: |
@@ -2451,7 +2451,7 @@ RAND_query_egd_bytes 2945 EXIST::FUNCTION: | |||
2451 | UI_method_get_writer 2946 EXIST::FUNCTION: | 2451 | UI_method_get_writer 2946 EXIST::FUNCTION: |
2452 | UI_OpenSSL 2947 EXIST::FUNCTION: | 2452 | UI_OpenSSL 2947 EXIST::FUNCTION: |
2453 | PEM_def_callback 2948 EXIST::FUNCTION: | 2453 | PEM_def_callback 2948 EXIST::FUNCTION: |
2454 | ENGINE_cleanup 2949 EXIST::FUNCTION: | 2454 | ENGINE_cleanup 2949 EXIST::FUNCTION:ENGINE |
2455 | DIST_POINT_it 2950 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | 2455 | DIST_POINT_it 2950 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: |
2456 | DIST_POINT_it 2950 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | 2456 | DIST_POINT_it 2950 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: |
2457 | OCSP_SINGLERESP_it 2951 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | 2457 | OCSP_SINGLERESP_it 2951 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: |
@@ -2475,7 +2475,7 @@ OCSP_RESPID_new 2967 EXIST::FUNCTION: | |||
2475 | OCSP_RESPDATA_it 2968 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | 2475 | OCSP_RESPDATA_it 2968 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: |
2476 | OCSP_RESPDATA_it 2968 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | 2476 | OCSP_RESPDATA_it 2968 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: |
2477 | d2i_OCSP_RESPDATA 2969 EXIST::FUNCTION: | 2477 | d2i_OCSP_RESPDATA 2969 EXIST::FUNCTION: |
2478 | ENGINE_register_all_complete 2970 EXIST::FUNCTION: | 2478 | ENGINE_register_all_complete 2970 EXIST::FUNCTION:ENGINE |
2479 | OCSP_check_validity 2971 EXIST::FUNCTION: | 2479 | OCSP_check_validity 2971 EXIST::FUNCTION: |
2480 | PKCS12_BAGS_it 2972 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | 2480 | PKCS12_BAGS_it 2972 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: |
2481 | PKCS12_BAGS_it 2972 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | 2481 | PKCS12_BAGS_it 2972 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: |
@@ -2487,7 +2487,7 @@ KRB5_AUTHENTBODY_it 2976 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTI | |||
2487 | X509_supported_extension 2977 EXIST::FUNCTION: | 2487 | X509_supported_extension 2977 EXIST::FUNCTION: |
2488 | i2d_KRB5_AUTHDATA 2978 EXIST::FUNCTION: | 2488 | i2d_KRB5_AUTHDATA 2978 EXIST::FUNCTION: |
2489 | UI_method_get_opener 2979 EXIST::FUNCTION: | 2489 | UI_method_get_opener 2979 EXIST::FUNCTION: |
2490 | ENGINE_set_ex_data 2980 EXIST::FUNCTION: | 2490 | ENGINE_set_ex_data 2980 EXIST::FUNCTION:ENGINE |
2491 | OCSP_REQUEST_print 2981 EXIST::FUNCTION: | 2491 | OCSP_REQUEST_print 2981 EXIST::FUNCTION: |
2492 | CBIGNUM_it 2982 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | 2492 | CBIGNUM_it 2982 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: |
2493 | CBIGNUM_it 2982 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | 2493 | CBIGNUM_it 2982 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: |
@@ -2501,7 +2501,7 @@ OCSP_single_get0_status 2989 EXIST::FUNCTION: | |||
2501 | BN_swap 2990 EXIST::FUNCTION: | 2501 | BN_swap 2990 EXIST::FUNCTION: |
2502 | POLICYINFO_it 2991 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | 2502 | POLICYINFO_it 2991 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: |
2503 | POLICYINFO_it 2991 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | 2503 | POLICYINFO_it 2991 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: |
2504 | ENGINE_set_destroy_function 2992 EXIST::FUNCTION: | 2504 | ENGINE_set_destroy_function 2992 EXIST::FUNCTION:ENGINE |
2505 | asn1_enc_free 2993 EXIST::FUNCTION: | 2505 | asn1_enc_free 2993 EXIST::FUNCTION: |
2506 | OCSP_RESPID_it 2994 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | 2506 | OCSP_RESPID_it 2994 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: |
2507 | OCSP_RESPID_it 2994 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | 2507 | OCSP_RESPID_it 2994 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: |
@@ -2523,8 +2523,8 @@ EDIPARTYNAME_it 3005 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTI | |||
2523 | NETSCAPE_SPKI_it 3006 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | 2523 | NETSCAPE_SPKI_it 3006 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: |
2524 | NETSCAPE_SPKI_it 3006 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | 2524 | NETSCAPE_SPKI_it 3006 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: |
2525 | UI_get0_test_string 3007 EXIST::FUNCTION: | 2525 | UI_get0_test_string 3007 EXIST::FUNCTION: |
2526 | ENGINE_get_cipher_engine 3008 EXIST::FUNCTION: | 2526 | ENGINE_get_cipher_engine 3008 EXIST::FUNCTION:ENGINE |
2527 | ENGINE_register_all_ciphers 3009 EXIST::FUNCTION: | 2527 | ENGINE_register_all_ciphers 3009 EXIST::FUNCTION:ENGINE |
2528 | EC_POINT_copy 3010 EXIST::FUNCTION:EC | 2528 | EC_POINT_copy 3010 EXIST::FUNCTION:EC |
2529 | BN_kronecker 3011 EXIST::FUNCTION: | 2529 | BN_kronecker 3011 EXIST::FUNCTION: |
2530 | _ossl_old_des_ede3_ofb64_encrypt 3012 EXIST:!VMS:FUNCTION:DES | 2530 | _ossl_old_des_ede3_ofb64_encrypt 3012 EXIST:!VMS:FUNCTION:DES |
@@ -2545,9 +2545,9 @@ OCSP_RESPONSE_new 3023 EXIST::FUNCTION: | |||
2545 | AES_set_encrypt_key 3024 EXIST::FUNCTION:AES | 2545 | AES_set_encrypt_key 3024 EXIST::FUNCTION:AES |
2546 | OCSP_resp_count 3025 EXIST::FUNCTION: | 2546 | OCSP_resp_count 3025 EXIST::FUNCTION: |
2547 | KRB5_CHECKSUM_new 3026 EXIST::FUNCTION: | 2547 | KRB5_CHECKSUM_new 3026 EXIST::FUNCTION: |
2548 | ENGINE_load_cswift 3027 EXIST::FUNCTION: | 2548 | ENGINE_load_cswift 3027 EXIST::FUNCTION:ENGINE |
2549 | OCSP_onereq_get0_id 3028 EXIST::FUNCTION: | 2549 | OCSP_onereq_get0_id 3028 EXIST::FUNCTION: |
2550 | ENGINE_set_default_ciphers 3029 EXIST::FUNCTION: | 2550 | ENGINE_set_default_ciphers 3029 EXIST::FUNCTION:ENGINE |
2551 | NOTICEREF_it 3030 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | 2551 | NOTICEREF_it 3030 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: |
2552 | NOTICEREF_it 3030 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | 2552 | NOTICEREF_it 3030 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: |
2553 | X509V3_EXT_CRL_add_nconf 3031 EXIST::FUNCTION: | 2553 | X509V3_EXT_CRL_add_nconf 3031 EXIST::FUNCTION: |
@@ -2565,7 +2565,7 @@ AES_decrypt 3040 EXIST::FUNCTION:AES | |||
2565 | asn1_enc_init 3041 EXIST::FUNCTION: | 2565 | asn1_enc_init 3041 EXIST::FUNCTION: |
2566 | UI_get_result_maxsize 3042 EXIST::FUNCTION: | 2566 | UI_get_result_maxsize 3042 EXIST::FUNCTION: |
2567 | OCSP_CERTID_new 3043 EXIST::FUNCTION: | 2567 | OCSP_CERTID_new 3043 EXIST::FUNCTION: |
2568 | ENGINE_unregister_RAND 3044 EXIST::FUNCTION: | 2568 | ENGINE_unregister_RAND 3044 EXIST::FUNCTION:ENGINE |
2569 | UI_method_get_closer 3045 EXIST::FUNCTION: | 2569 | UI_method_get_closer 3045 EXIST::FUNCTION: |
2570 | d2i_KRB5_ENCDATA 3046 EXIST::FUNCTION: | 2570 | d2i_KRB5_ENCDATA 3046 EXIST::FUNCTION: |
2571 | OCSP_request_onereq_count 3047 EXIST::FUNCTION: | 2571 | OCSP_request_onereq_count 3047 EXIST::FUNCTION: |
@@ -2576,7 +2576,7 @@ ASN1_primitive_free 3051 EXIST::FUNCTION: | |||
2576 | i2d_EXTENDED_KEY_USAGE 3052 EXIST::FUNCTION: | 2576 | i2d_EXTENDED_KEY_USAGE 3052 EXIST::FUNCTION: |
2577 | i2d_OCSP_SIGNATURE 3053 EXIST::FUNCTION: | 2577 | i2d_OCSP_SIGNATURE 3053 EXIST::FUNCTION: |
2578 | asn1_enc_save 3054 EXIST::FUNCTION: | 2578 | asn1_enc_save 3054 EXIST::FUNCTION: |
2579 | ENGINE_load_nuron 3055 EXIST::FUNCTION: | 2579 | ENGINE_load_nuron 3055 EXIST::FUNCTION:ENGINE |
2580 | _ossl_old_des_pcbc_encrypt 3056 EXIST::FUNCTION:DES | 2580 | _ossl_old_des_pcbc_encrypt 3056 EXIST::FUNCTION:DES |
2581 | PKCS12_MAC_DATA_it 3057 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | 2581 | PKCS12_MAC_DATA_it 3057 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: |
2582 | PKCS12_MAC_DATA_it 3057 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | 2582 | PKCS12_MAC_DATA_it 3057 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: |
@@ -2598,15 +2598,15 @@ ASN1_item_d2i_bio 3069 EXIST::FUNCTION:BIO | |||
2598 | EC_POINT_dbl 3070 EXIST::FUNCTION:EC | 2598 | EC_POINT_dbl 3070 EXIST::FUNCTION:EC |
2599 | asn1_get_choice_selector 3071 EXIST::FUNCTION: | 2599 | asn1_get_choice_selector 3071 EXIST::FUNCTION: |
2600 | i2d_KRB5_CHECKSUM 3072 EXIST::FUNCTION: | 2600 | i2d_KRB5_CHECKSUM 3072 EXIST::FUNCTION: |
2601 | ENGINE_set_table_flags 3073 EXIST::FUNCTION: | 2601 | ENGINE_set_table_flags 3073 EXIST::FUNCTION:ENGINE |
2602 | AES_options 3074 EXIST::FUNCTION:AES | 2602 | AES_options 3074 EXIST::FUNCTION:AES |
2603 | ENGINE_load_chil 3075 EXIST::FUNCTION: | 2603 | ENGINE_load_chil 3075 EXIST::FUNCTION:ENGINE |
2604 | OCSP_id_cmp 3076 EXIST::FUNCTION: | 2604 | OCSP_id_cmp 3076 EXIST::FUNCTION: |
2605 | OCSP_BASICRESP_new 3077 EXIST::FUNCTION: | 2605 | OCSP_BASICRESP_new 3077 EXIST::FUNCTION: |
2606 | OCSP_REQUEST_get_ext_by_NID 3078 EXIST::FUNCTION: | 2606 | OCSP_REQUEST_get_ext_by_NID 3078 EXIST::FUNCTION: |
2607 | KRB5_APREQ_it 3079 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | 2607 | KRB5_APREQ_it 3079 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: |
2608 | KRB5_APREQ_it 3079 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | 2608 | KRB5_APREQ_it 3079 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: |
2609 | ENGINE_get_destroy_function 3080 EXIST::FUNCTION: | 2609 | ENGINE_get_destroy_function 3080 EXIST::FUNCTION:ENGINE |
2610 | CONF_set_nconf 3081 EXIST::FUNCTION: | 2610 | CONF_set_nconf 3081 EXIST::FUNCTION: |
2611 | ASN1_PRINTABLE_free 3082 EXIST::FUNCTION: | 2611 | ASN1_PRINTABLE_free 3082 EXIST::FUNCTION: |
2612 | OCSP_BASICRESP_get_ext_by_NID 3083 EXIST::FUNCTION: | 2612 | OCSP_BASICRESP_get_ext_by_NID 3083 EXIST::FUNCTION: |
@@ -2667,7 +2667,7 @@ OCSP_CRLID_it 3127 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIA | |||
2667 | OCSP_CRLID_it 3127 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | 2667 | OCSP_CRLID_it 3127 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: |
2668 | i2d_KRB5_AUTHENTBODY 3128 EXIST::FUNCTION: | 2668 | i2d_KRB5_AUTHENTBODY 3128 EXIST::FUNCTION: |
2669 | OCSP_REQUEST_get_ext_count 3129 EXIST::FUNCTION: | 2669 | OCSP_REQUEST_get_ext_count 3129 EXIST::FUNCTION: |
2670 | ENGINE_load_atalla 3130 EXIST::FUNCTION: | 2670 | ENGINE_load_atalla 3130 EXIST::FUNCTION:ENGINE |
2671 | X509_NAME_it 3131 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | 2671 | X509_NAME_it 3131 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: |
2672 | X509_NAME_it 3131 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | 2672 | X509_NAME_it 3131 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: |
2673 | USERNOTICE_it 3132 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | 2673 | USERNOTICE_it 3132 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: |
@@ -2685,7 +2685,7 @@ UI_method_set_opener 3140 EXIST::FUNCTION: | |||
2685 | ASN1_item_ex_free 3141 EXIST::FUNCTION: | 2685 | ASN1_item_ex_free 3141 EXIST::FUNCTION: |
2686 | ASN1_BOOLEAN_it 3142 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | 2686 | ASN1_BOOLEAN_it 3142 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: |
2687 | ASN1_BOOLEAN_it 3142 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | 2687 | ASN1_BOOLEAN_it 3142 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: |
2688 | ENGINE_get_table_flags 3143 EXIST::FUNCTION: | 2688 | ENGINE_get_table_flags 3143 EXIST::FUNCTION:ENGINE |
2689 | UI_create_method 3144 EXIST::FUNCTION: | 2689 | UI_create_method 3144 EXIST::FUNCTION: |
2690 | OCSP_ONEREQ_add1_ext_i2d 3145 EXIST::FUNCTION: | 2690 | OCSP_ONEREQ_add1_ext_i2d 3145 EXIST::FUNCTION: |
2691 | _shadow_DES_check_key 3146 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:DES | 2691 | _shadow_DES_check_key 3146 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:DES |
@@ -2709,7 +2709,7 @@ PKCS7_it 3160 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIA | |||
2709 | PKCS7_it 3160 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | 2709 | PKCS7_it 3160 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: |
2710 | OCSP_REQUEST_get_ext_by_critical 3161 EXIST:!VMS:FUNCTION: | 2710 | OCSP_REQUEST_get_ext_by_critical 3161 EXIST:!VMS:FUNCTION: |
2711 | OCSP_REQUEST_get_ext_by_crit 3161 EXIST:VMS:FUNCTION: | 2711 | OCSP_REQUEST_get_ext_by_crit 3161 EXIST:VMS:FUNCTION: |
2712 | ENGINE_set_flags 3162 EXIST::FUNCTION: | 2712 | ENGINE_set_flags 3162 EXIST::FUNCTION:ENGINE |
2713 | _ossl_old_des_ecb_encrypt 3163 EXIST::FUNCTION:DES | 2713 | _ossl_old_des_ecb_encrypt 3163 EXIST::FUNCTION:DES |
2714 | OCSP_response_get1_basic 3164 EXIST::FUNCTION: | 2714 | OCSP_response_get1_basic 3164 EXIST::FUNCTION: |
2715 | EVP_Digest 3165 EXIST::FUNCTION: | 2715 | EVP_Digest 3165 EXIST::FUNCTION: |
@@ -2721,8 +2721,8 @@ ASN1_TIME_to_generalizedtime 3169 EXIST::FUNCTION: | |||
2721 | BIGNUM_it 3170 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | 2721 | BIGNUM_it 3170 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: |
2722 | BIGNUM_it 3170 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | 2722 | BIGNUM_it 3170 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: |
2723 | AES_cbc_encrypt 3171 EXIST::FUNCTION:AES | 2723 | AES_cbc_encrypt 3171 EXIST::FUNCTION:AES |
2724 | ENGINE_get_load_privkey_function 3172 EXIST:!VMS:FUNCTION: | 2724 | ENGINE_get_load_privkey_function 3172 EXIST:!VMS:FUNCTION:ENGINE |
2725 | ENGINE_get_load_privkey_fn 3172 EXIST:VMS:FUNCTION: | 2725 | ENGINE_get_load_privkey_fn 3172 EXIST:VMS:FUNCTION:ENGINE |
2726 | OCSP_RESPONSE_free 3173 EXIST::FUNCTION: | 2726 | OCSP_RESPONSE_free 3173 EXIST::FUNCTION: |
2727 | UI_method_set_reader 3174 EXIST::FUNCTION: | 2727 | UI_method_set_reader 3174 EXIST::FUNCTION: |
2728 | i2d_ASN1_T61STRING 3175 EXIST::FUNCTION: | 2728 | i2d_ASN1_T61STRING 3175 EXIST::FUNCTION: |
@@ -2736,7 +2736,7 @@ OCSP_crlID_new 3181 EXIST:!OS2,!VMS,!WIN16:FUNCTION: | |||
2736 | OCSP_crlID2_new 3181 EXIST:OS2,VMS,WIN16:FUNCTION: | 2736 | OCSP_crlID2_new 3181 EXIST:OS2,VMS,WIN16:FUNCTION: |
2737 | CONF_modules_load_file 3182 EXIST::FUNCTION: | 2737 | CONF_modules_load_file 3182 EXIST::FUNCTION: |
2738 | CONF_imodule_set_usr_data 3183 EXIST::FUNCTION: | 2738 | CONF_imodule_set_usr_data 3183 EXIST::FUNCTION: |
2739 | ENGINE_set_default_string 3184 EXIST::FUNCTION: | 2739 | ENGINE_set_default_string 3184 EXIST::FUNCTION:ENGINE |
2740 | CONF_module_get_usr_data 3185 EXIST::FUNCTION: | 2740 | CONF_module_get_usr_data 3185 EXIST::FUNCTION: |
2741 | ASN1_add_oid_module 3186 EXIST::FUNCTION: | 2741 | ASN1_add_oid_module 3186 EXIST::FUNCTION: |
2742 | CONF_modules_finish 3187 EXIST::FUNCTION: | 2742 | CONF_modules_finish 3187 EXIST::FUNCTION: |
@@ -2754,7 +2754,7 @@ CONF_imodule_get_name 3198 EXIST::FUNCTION: | |||
2754 | ERR_peek_top_error 3199 NOEXIST::FUNCTION: | 2754 | ERR_peek_top_error 3199 NOEXIST::FUNCTION: |
2755 | CONF_imodule_get_usr_data 3200 EXIST::FUNCTION: | 2755 | CONF_imodule_get_usr_data 3200 EXIST::FUNCTION: |
2756 | CONF_imodule_set_flags 3201 EXIST::FUNCTION: | 2756 | CONF_imodule_set_flags 3201 EXIST::FUNCTION: |
2757 | ENGINE_add_conf_module 3202 EXIST::FUNCTION: | 2757 | ENGINE_add_conf_module 3202 EXIST::FUNCTION:ENGINE |
2758 | ERR_peek_last_error_line 3203 EXIST::FUNCTION: | 2758 | ERR_peek_last_error_line 3203 EXIST::FUNCTION: |
2759 | ERR_peek_last_error_line_data 3204 EXIST::FUNCTION: | 2759 | ERR_peek_last_error_line_data 3204 EXIST::FUNCTION: |
2760 | ERR_peek_last_error 3205 EXIST::FUNCTION: | 2760 | ERR_peek_last_error 3205 EXIST::FUNCTION: |
@@ -2762,8 +2762,8 @@ DES_read_2passwords 3206 EXIST::FUNCTION:DES | |||
2762 | DES_read_password 3207 EXIST::FUNCTION:DES | 2762 | DES_read_password 3207 EXIST::FUNCTION:DES |
2763 | UI_UTIL_read_pw 3208 EXIST::FUNCTION: | 2763 | UI_UTIL_read_pw 3208 EXIST::FUNCTION: |
2764 | UI_UTIL_read_pw_string 3209 EXIST::FUNCTION: | 2764 | UI_UTIL_read_pw_string 3209 EXIST::FUNCTION: |
2765 | ENGINE_load_aep 3210 EXIST::FUNCTION: | 2765 | ENGINE_load_aep 3210 EXIST::FUNCTION:ENGINE |
2766 | ENGINE_load_sureware 3211 EXIST::FUNCTION: | 2766 | ENGINE_load_sureware 3211 EXIST::FUNCTION:ENGINE |
2767 | OPENSSL_add_all_algorithms_noconf 3212 EXIST:!VMS:FUNCTION: | 2767 | OPENSSL_add_all_algorithms_noconf 3212 EXIST:!VMS:FUNCTION: |
2768 | OPENSSL_add_all_algo_noconf 3212 EXIST:VMS:FUNCTION: | 2768 | OPENSSL_add_all_algo_noconf 3212 EXIST:VMS:FUNCTION: |
2769 | OPENSSL_add_all_algorithms_conf 3213 EXIST:!VMS:FUNCTION: | 2769 | OPENSSL_add_all_algorithms_conf 3213 EXIST:!VMS:FUNCTION: |
@@ -2772,7 +2772,7 @@ OPENSSL_load_builtin_modules 3214 EXIST::FUNCTION: | |||
2772 | AES_ofb128_encrypt 3215 EXIST::FUNCTION:AES | 2772 | AES_ofb128_encrypt 3215 EXIST::FUNCTION:AES |
2773 | AES_ctr128_encrypt 3216 EXIST::FUNCTION:AES | 2773 | AES_ctr128_encrypt 3216 EXIST::FUNCTION:AES |
2774 | AES_cfb128_encrypt 3217 EXIST::FUNCTION:AES | 2774 | AES_cfb128_encrypt 3217 EXIST::FUNCTION:AES |
2775 | ENGINE_load_4758cca 3218 EXIST::FUNCTION: | 2775 | ENGINE_load_4758cca 3218 EXIST::FUNCTION:ENGINE |
2776 | _ossl_096_des_random_seed 3219 EXIST::FUNCTION:DES | 2776 | _ossl_096_des_random_seed 3219 EXIST::FUNCTION:DES |
2777 | EVP_aes_256_ofb 3220 EXIST::FUNCTION:AES | 2777 | EVP_aes_256_ofb 3220 EXIST::FUNCTION:AES |
2778 | EVP_aes_192_ofb 3221 EXIST::FUNCTION:AES | 2778 | EVP_aes_192_ofb 3221 EXIST::FUNCTION:AES |
@@ -2793,3 +2793,11 @@ ASN1_UNIVERSALSTRING_it 3234 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTI | |||
2793 | d2i_ASN1_UNIVERSALSTRING 3235 EXIST::FUNCTION: | 2793 | d2i_ASN1_UNIVERSALSTRING 3235 EXIST::FUNCTION: |
2794 | EVP_des_ede3_ecb 3236 EXIST::FUNCTION:DES | 2794 | EVP_des_ede3_ecb 3236 EXIST::FUNCTION:DES |
2795 | X509_REQ_print_ex 3237 EXIST::FUNCTION:BIO | 2795 | X509_REQ_print_ex 3237 EXIST::FUNCTION:BIO |
2796 | ENGINE_up_ref 3238 EXIST::FUNCTION:ENGINE | ||
2797 | BUF_MEM_grow_clean 3239 EXIST::FUNCTION: | ||
2798 | CRYPTO_realloc_clean 3240 EXIST::FUNCTION: | ||
2799 | BUF_strlcat 3241 EXIST::FUNCTION: | ||
2800 | BIO_indent 3242 EXIST::FUNCTION: | ||
2801 | BUF_strlcpy 3243 EXIST::FUNCTION: | ||
2802 | OpenSSLDie 3244 EXIST::FUNCTION: | ||
2803 | OPENSSL_cleanse 3245 EXIST::FUNCTION: | ||
diff --git a/src/lib/libcrypto/util/mk1mf.pl b/src/lib/libcrypto/util/mk1mf.pl index c9271bbffe..c538f9dffb 100644 --- a/src/lib/libcrypto/util/mk1mf.pl +++ b/src/lib/libcrypto/util/mk1mf.pl | |||
@@ -24,6 +24,7 @@ $infile="MINFO"; | |||
24 | 24 | ||
25 | %ops=( | 25 | %ops=( |
26 | "VC-WIN32", "Microsoft Visual C++ [4-6] - Windows NT or 9X", | 26 | "VC-WIN32", "Microsoft Visual C++ [4-6] - Windows NT or 9X", |
27 | "VC-CE", "Microsoft eMbedded Visual C++ 3.0 - Windows CE ONLY", | ||
27 | "VC-NT", "Microsoft Visual C++ [4-6] - Windows NT ONLY", | 28 | "VC-NT", "Microsoft Visual C++ [4-6] - Windows NT ONLY", |
28 | "VC-W31-16", "Microsoft Visual C++ 1.52 - Windows 3.1 - 286", | 29 | "VC-W31-16", "Microsoft Visual C++ 1.52 - Windows 3.1 - 286", |
29 | "VC-WIN16", "Alias for VC-W31-32", | 30 | "VC-WIN16", "Alias for VC-W31-32", |
@@ -63,6 +64,8 @@ and [options] can be one of | |||
63 | no-asm - No x86 asm | 64 | no-asm - No x86 asm |
64 | no-krb5 - No KRB5 | 65 | no-krb5 - No KRB5 |
65 | no-ec - No EC | 66 | no-ec - No EC |
67 | no-engine - No engine | ||
68 | no-hw - No hw | ||
66 | nasm - Use NASM for x86 asm | 69 | nasm - Use NASM for x86 asm |
67 | gaswin - Use GNU as with Mingw32 | 70 | gaswin - Use GNU as with Mingw32 |
68 | no-socks - No socket code | 71 | no-socks - No socket code |
@@ -137,6 +140,10 @@ elsif (($platform eq "VC-WIN32") || ($platform eq "VC-NT")) | |||
137 | $NT = 1 if $platform eq "VC-NT"; | 140 | $NT = 1 if $platform eq "VC-NT"; |
138 | require 'VC-32.pl'; | 141 | require 'VC-32.pl'; |
139 | } | 142 | } |
143 | elsif ($platform eq "VC-CE") | ||
144 | { | ||
145 | require 'VC-CE.pl'; | ||
146 | } | ||
140 | elsif ($platform eq "Mingw32") | 147 | elsif ($platform eq "Mingw32") |
141 | { | 148 | { |
142 | require 'Mingw32.pl'; | 149 | require 'Mingw32.pl'; |
@@ -213,7 +220,7 @@ $cflags.=" -DOPENSSL_NO_MD4" if $no_md4; | |||
213 | $cflags.=" -DOPENSSL_NO_MD5" if $no_md5; | 220 | $cflags.=" -DOPENSSL_NO_MD5" if $no_md5; |
214 | $cflags.=" -DOPENSSL_NO_SHA" if $no_sha; | 221 | $cflags.=" -DOPENSSL_NO_SHA" if $no_sha; |
215 | $cflags.=" -DOPENSSL_NO_SHA1" if $no_sha1; | 222 | $cflags.=" -DOPENSSL_NO_SHA1" if $no_sha1; |
216 | $cflags.=" -DOPENSSL_NO_RIPEMD" if $no_rmd160; | 223 | $cflags.=" -DOPENSSL_NO_RIPEMD" if $no_ripemd; |
217 | $cflags.=" -DOPENSSL_NO_MDC2" if $no_mdc2; | 224 | $cflags.=" -DOPENSSL_NO_MDC2" if $no_mdc2; |
218 | $cflags.=" -DOPENSSL_NO_BF" if $no_bf; | 225 | $cflags.=" -DOPENSSL_NO_BF" if $no_bf; |
219 | $cflags.=" -DOPENSSL_NO_CAST" if $no_cast; | 226 | $cflags.=" -DOPENSSL_NO_CAST" if $no_cast; |
@@ -227,6 +234,8 @@ $cflags.=" -DOPENSSL_NO_SSL3" if $no_ssl3; | |||
227 | $cflags.=" -DOPENSSL_NO_ERR" if $no_err; | 234 | $cflags.=" -DOPENSSL_NO_ERR" if $no_err; |
228 | $cflags.=" -DOPENSSL_NO_KRB5" if $no_krb5; | 235 | $cflags.=" -DOPENSSL_NO_KRB5" if $no_krb5; |
229 | $cflags.=" -DOPENSSL_NO_EC" if $no_ec; | 236 | $cflags.=" -DOPENSSL_NO_EC" if $no_ec; |
237 | $cflags.=" -DOPENSSL_NO_ENGINE" if $no_engine; | ||
238 | $cflags.=" -DOPENSSL_NO_HW" if $no_hw; | ||
230 | #$cflags.=" -DRSAref" if $rsaref ne ""; | 239 | #$cflags.=" -DRSAref" if $rsaref ne ""; |
231 | 240 | ||
232 | ## if ($unix) | 241 | ## if ($unix) |
@@ -266,6 +275,17 @@ $defs= <<"EOF"; | |||
266 | # The one monster makefile better suits building in non-unix | 275 | # The one monster makefile better suits building in non-unix |
267 | # environments. | 276 | # environments. |
268 | 277 | ||
278 | EOF | ||
279 | |||
280 | if ($platform eq "VC-CE") | ||
281 | { | ||
282 | $defs.= <<"EOF"; | ||
283 | !INCLUDE <\$(WCECOMPAT)/wcedefs.mak> | ||
284 | |||
285 | EOF | ||
286 | } | ||
287 | |||
288 | $defs.= <<"EOF"; | ||
269 | INSTALLTOP=$INSTALLTOP | 289 | INSTALLTOP=$INSTALLTOP |
270 | 290 | ||
271 | # Set your compiler options | 291 | # Set your compiler options |
@@ -632,6 +652,8 @@ sub var_add | |||
632 | local($dir,$val)=@_; | 652 | local($dir,$val)=@_; |
633 | local(@a,$_,$ret); | 653 | local(@a,$_,$ret); |
634 | 654 | ||
655 | return("") if $no_engine && $dir =~ /\/engine/; | ||
656 | return("") if $no_hw && $dir =~ /\/hw/; | ||
635 | return("") if $no_idea && $dir =~ /\/idea/; | 657 | return("") if $no_idea && $dir =~ /\/idea/; |
636 | return("") if $no_aes && $dir =~ /\/aes/; | 658 | return("") if $no_aes && $dir =~ /\/aes/; |
637 | return("") if $no_rc2 && $dir =~ /\/rc2/; | 659 | return("") if $no_rc2 && $dir =~ /\/rc2/; |
@@ -641,6 +663,7 @@ sub var_add | |||
641 | return("") if $no_rsa && $dir =~ /^rsaref/; | 663 | return("") if $no_rsa && $dir =~ /^rsaref/; |
642 | return("") if $no_dsa && $dir =~ /\/dsa/; | 664 | return("") if $no_dsa && $dir =~ /\/dsa/; |
643 | return("") if $no_dh && $dir =~ /\/dh/; | 665 | return("") if $no_dh && $dir =~ /\/dh/; |
666 | return("") if $no_ec && $dir =~ /\/ec/; | ||
644 | if ($no_des && $dir =~ /\/des/) | 667 | if ($no_des && $dir =~ /\/des/) |
645 | { | 668 | { |
646 | if ($val =~ /read_pwd/) | 669 | if ($val =~ /read_pwd/) |
@@ -675,7 +698,7 @@ sub var_add | |||
675 | @a=grep(!/(^md2)|(_md2$)/,@a) if $no_md2; | 698 | @a=grep(!/(^md2)|(_md2$)/,@a) if $no_md2; |
676 | @a=grep(!/(^md4)|(_md4$)/,@a) if $no_md4; | 699 | @a=grep(!/(^md4)|(_md4$)/,@a) if $no_md4; |
677 | @a=grep(!/(^md5)|(_md5$)/,@a) if $no_md5; | 700 | @a=grep(!/(^md5)|(_md5$)/,@a) if $no_md5; |
678 | @a=grep(!/(rmd)|(ripemd)/,@a) if $no_rmd160; | 701 | @a=grep(!/(rmd)|(ripemd)/,@a) if $no_ripemd; |
679 | 702 | ||
680 | @a=grep(!/(^d2i_r_)|(^i2d_r_)/,@a) if $no_rsa; | 703 | @a=grep(!/(^d2i_r_)|(^i2d_r_)/,@a) if $no_rsa; |
681 | @a=grep(!/(^p_open$)|(^p_seal$)/,@a) if $no_rsa; | 704 | @a=grep(!/(^p_open$)|(^p_seal$)/,@a) if $no_rsa; |
@@ -692,6 +715,8 @@ sub var_add | |||
692 | @a=grep(!/(^sha1)|(_sha1$)|(m_dss1$)/,@a) if $no_sha1; | 715 | @a=grep(!/(^sha1)|(_sha1$)|(m_dss1$)/,@a) if $no_sha1; |
693 | @a=grep(!/_mdc2$/,@a) if $no_mdc2; | 716 | @a=grep(!/_mdc2$/,@a) if $no_mdc2; |
694 | 717 | ||
718 | @a=grep(!/^engine$/,@a) if $no_engine; | ||
719 | @a=grep(!/^hw$/,@a) if $no_hw; | ||
695 | @a=grep(!/(^rsa$)|(^genrsa$)/,@a) if $no_rsa; | 720 | @a=grep(!/(^rsa$)|(^genrsa$)/,@a) if $no_rsa; |
696 | @a=grep(!/(^dsa$)|(^gendsa$)|(^dsaparam$)/,@a) if $no_dsa; | 721 | @a=grep(!/(^dsa$)|(^gendsa$)|(^dsaparam$)/,@a) if $no_dsa; |
697 | @a=grep(!/^gendsa$/,@a) if $no_sha1; | 722 | @a=grep(!/^gendsa$/,@a) if $no_sha1; |
@@ -885,10 +910,12 @@ sub read_options | |||
885 | elsif (/^no-sock$/) { $no_sock=1; } | 910 | elsif (/^no-sock$/) { $no_sock=1; } |
886 | elsif (/^no-krb5$/) { $no_krb5=1; } | 911 | elsif (/^no-krb5$/) { $no_krb5=1; } |
887 | elsif (/^no-ec$/) { $no_ec=1; } | 912 | elsif (/^no-ec$/) { $no_ec=1; } |
913 | elsif (/^no-engine$/) { $no_engine=1; } | ||
914 | elsif (/^no-hw$/) { $no_hw=1; } | ||
888 | 915 | ||
889 | elsif (/^just-ssl$/) { $no_rc2=$no_idea=$no_des=$no_bf=$no_cast=1; | 916 | elsif (/^just-ssl$/) { $no_rc2=$no_idea=$no_des=$no_bf=$no_cast=1; |
890 | $no_md2=$no_sha=$no_mdc2=$no_dsa=$no_dh=1; | 917 | $no_md2=$no_sha=$no_mdc2=$no_dsa=$no_dh=1; |
891 | $no_ssl2=$no_err=$no_rmd160=$no_rc5=1; | 918 | $no_ssl2=$no_err=$no_ripemd=$no_rc5=1; |
892 | $no_aes=1; } | 919 | $no_aes=1; } |
893 | 920 | ||
894 | elsif (/^rsaref$/) { } | 921 | elsif (/^rsaref$/) { } |
diff --git a/src/lib/libcrypto/util/mkcerts.sh b/src/lib/libcrypto/util/mkcerts.sh index 5f8a1dae73..0184fcb70e 100644 --- a/src/lib/libcrypto/util/mkcerts.sh +++ b/src/lib/libcrypto/util/mkcerts.sh | |||
@@ -1,4 +1,4 @@ | |||
1 | #!bin/sh | 1 | #!/bin/sh |
2 | 2 | ||
3 | # This script will re-make all the required certs. | 3 | # This script will re-make all the required certs. |
4 | # cd apps | 4 | # cd apps |
@@ -12,8 +12,8 @@ | |||
12 | # | 12 | # |
13 | 13 | ||
14 | CAbits=1024 | 14 | CAbits=1024 |
15 | SSLEAY="../apps/ssleay" | 15 | SSLEAY="../apps/openssl" |
16 | CONF="-config ../apps/ssleay.cnf" | 16 | CONF="-config ../apps/openssl.cnf" |
17 | 17 | ||
18 | # create pca request. | 18 | # create pca request. |
19 | echo creating $CAbits bit PCA cert request | 19 | echo creating $CAbits bit PCA cert request |
diff --git a/src/lib/libcrypto/util/mkdef.pl b/src/lib/libcrypto/util/mkdef.pl index adfd447dd3..cdd2164c4e 100644 --- a/src/lib/libcrypto/util/mkdef.pl +++ b/src/lib/libcrypto/util/mkdef.pl | |||
@@ -91,7 +91,7 @@ my @known_algorithms = ( "RC2", "RC4", "RC5", "IDEA", "DES", "BF", | |||
91 | "BIO", "COMP", "BUFFER", "LHASH", "STACK", "ERR", | 91 | "BIO", "COMP", "BUFFER", "LHASH", "STACK", "ERR", |
92 | "LOCKING", | 92 | "LOCKING", |
93 | # External "algorithms" | 93 | # External "algorithms" |
94 | "FP_API", "STDIO", "SOCK", "KRB5" ); | 94 | "FP_API", "STDIO", "SOCK", "KRB5", "ENGINE", "HW" ); |
95 | 95 | ||
96 | my $options=""; | 96 | my $options=""; |
97 | open(IN,"<Makefile.ssl") || die "unable to open Makefile.ssl!\n"; | 97 | open(IN,"<Makefile.ssl") || die "unable to open Makefile.ssl!\n"; |
@@ -107,7 +107,7 @@ my $no_rc2; my $no_rc4; my $no_rc5; my $no_idea; my $no_des; my $no_bf; | |||
107 | my $no_cast; | 107 | my $no_cast; |
108 | my $no_md2; my $no_md4; my $no_md5; my $no_sha; my $no_ripemd; my $no_mdc2; | 108 | my $no_md2; my $no_md4; my $no_md5; my $no_sha; my $no_ripemd; my $no_mdc2; |
109 | my $no_rsa; my $no_dsa; my $no_dh; my $no_hmac=0; my $no_aes; my $no_krb5; | 109 | my $no_rsa; my $no_dsa; my $no_dh; my $no_hmac=0; my $no_aes; my $no_krb5; |
110 | my $no_ec; | 110 | my $no_ec; my $no_engine; my $no_hw; |
111 | my $no_fp_api; | 111 | my $no_fp_api; |
112 | 112 | ||
113 | foreach (@ARGV, split(/ /, $options)) | 113 | foreach (@ARGV, split(/ /, $options)) |
@@ -176,6 +176,8 @@ foreach (@ARGV, split(/ /, $options)) | |||
176 | elsif (/^no-comp$/) { $no_comp=1; } | 176 | elsif (/^no-comp$/) { $no_comp=1; } |
177 | elsif (/^no-dso$/) { $no_dso=1; } | 177 | elsif (/^no-dso$/) { $no_dso=1; } |
178 | elsif (/^no-krb5$/) { $no_krb5=1; } | 178 | elsif (/^no-krb5$/) { $no_krb5=1; } |
179 | elsif (/^no-engine$/) { $no_engine=1; } | ||
180 | elsif (/^no-hw$/) { $no_hw=1; } | ||
179 | } | 181 | } |
180 | 182 | ||
181 | 183 | ||
@@ -235,7 +237,7 @@ $crypto.=" crypto/dh/dh.h" ; # unless $no_dh; | |||
235 | $crypto.=" crypto/ec/ec.h" ; # unless $no_ec; | 237 | $crypto.=" crypto/ec/ec.h" ; # unless $no_ec; |
236 | $crypto.=" crypto/hmac/hmac.h" ; # unless $no_hmac; | 238 | $crypto.=" crypto/hmac/hmac.h" ; # unless $no_hmac; |
237 | 239 | ||
238 | $crypto.=" crypto/engine/engine.h"; | 240 | $crypto.=" crypto/engine/engine.h"; # unless $no_engine; |
239 | $crypto.=" crypto/stack/stack.h" ; # unless $no_stack; | 241 | $crypto.=" crypto/stack/stack.h" ; # unless $no_stack; |
240 | $crypto.=" crypto/buffer/buffer.h" ; # unless $no_buffer; | 242 | $crypto.=" crypto/buffer/buffer.h" ; # unless $no_buffer; |
241 | $crypto.=" crypto/bio/bio.h" ; # unless $no_bio; | 243 | $crypto.=" crypto/bio/bio.h" ; # unless $no_bio; |
@@ -438,7 +440,12 @@ sub do_defs | |||
438 | } | 440 | } |
439 | 441 | ||
440 | s/\/\*.*?\*\///gs; # ignore comments | 442 | s/\/\*.*?\*\///gs; # ignore comments |
443 | if (/\/\*/) { # if we have part | ||
444 | $line = $_; # of a comment, | ||
445 | next; # continue reading | ||
446 | } | ||
441 | s/{[^{}]*}//gs; # ignore {} blocks | 447 | s/{[^{}]*}//gs; # ignore {} blocks |
448 | print STDERR "DEBUG: \$def=\"$def\"\n" if $debug && $def ne ""; | ||
442 | print STDERR "DEBUG: \$_=\"$_\"\n" if $debug; | 449 | print STDERR "DEBUG: \$_=\"$_\"\n" if $debug; |
443 | if (/^\#\s*ifndef\s+(.*)/) { | 450 | if (/^\#\s*ifndef\s+(.*)/) { |
444 | push(@tag,"-"); | 451 | push(@tag,"-"); |
@@ -812,14 +819,14 @@ sub do_defs | |||
812 | } elsif (/\(\*(\w*(\{[0-9]+\})?)\([^\)]+/) { | 819 | } elsif (/\(\*(\w*(\{[0-9]+\})?)\([^\)]+/) { |
813 | $s = $1; | 820 | $s = $1; |
814 | print STDERR "DEBUG: found ANSI C function $s\n" if $debug; | 821 | print STDERR "DEBUG: found ANSI C function $s\n" if $debug; |
815 | } elsif (/\w+\W+(\w+)\W*\(\s*\)$/s) { | 822 | } elsif (/\w+\W+(\w+)\W*\(\s*\)(\s*__attribute__\(.*\)\s*)?$/s) { |
816 | # K&R C | 823 | # K&R C |
817 | print STDERR "DEBUG: found K&R C function $s\n" if $debug; | 824 | print STDERR "DEBUG: found K&R C function $s\n" if $debug; |
818 | next; | 825 | next; |
819 | } elsif (/\w+\W+\w+(\{[0-9]+\})?\W*\(.*\)$/s) { | 826 | } elsif (/\w+\W+\w+(\{[0-9]+\})?\W*\(.*\)(\s*__attribute__\(.*\)\s*)?$/s) { |
820 | while (not /\(\)$/s) { | 827 | while (not /\(\)(\s*__attribute__\(.*\)\s*)?$/s) { |
821 | s/[^\(\)]*\)$/\)/s; | 828 | s/[^\(\)]*\)(\s*__attribute__\(.*\)\s*)?$/\)/s; |
822 | s/\([^\(\)]*\)\)$/\)/s; | 829 | s/\([^\(\)]*\)\)(\s*__attribute__\(.*\)\s*)?$/\)/s; |
823 | } | 830 | } |
824 | s/\(void\)//; | 831 | s/\(void\)//; |
825 | /(\w+(\{[0-9]+\})?)\W*\(\)/s; | 832 | /(\w+(\{[0-9]+\})?)\W*\(\)/s; |
@@ -1052,6 +1059,8 @@ sub is_valid | |||
1052 | if ($keyword eq "COMP" && $no_comp) { return 0; } | 1059 | if ($keyword eq "COMP" && $no_comp) { return 0; } |
1053 | if ($keyword eq "DSO" && $no_dso) { return 0; } | 1060 | if ($keyword eq "DSO" && $no_dso) { return 0; } |
1054 | if ($keyword eq "KRB5" && $no_krb5) { return 0; } | 1061 | if ($keyword eq "KRB5" && $no_krb5) { return 0; } |
1062 | if ($keyword eq "ENGINE" && $no_engine) { return 0; } | ||
1063 | if ($keyword eq "HW" && $no_hw) { return 0; } | ||
1055 | if ($keyword eq "FP_API" && $no_fp_api) { return 0; } | 1064 | if ($keyword eq "FP_API" && $no_fp_api) { return 0; } |
1056 | 1065 | ||
1057 | # Nothing recognise as true | 1066 | # Nothing recognise as true |
diff --git a/src/lib/libcrypto/util/pl/BC-32.pl b/src/lib/libcrypto/util/pl/BC-32.pl index bd7a9d9301..e83b336190 100644 --- a/src/lib/libcrypto/util/pl/BC-32.pl +++ b/src/lib/libcrypto/util/pl/BC-32.pl | |||
@@ -51,9 +51,9 @@ $lfile=''; | |||
51 | $shlib_ex_obj=""; | 51 | $shlib_ex_obj=""; |
52 | $app_ex_obj="c0x32.obj"; | 52 | $app_ex_obj="c0x32.obj"; |
53 | 53 | ||
54 | $asm='nasmw'; | 54 | $asm='nasmw -f obj'; |
55 | $asm.=" /Zi" if $debug; | 55 | $asm.=" /Zi" if $debug; |
56 | $afile='-f obj -o'; | 56 | $afile='-o'; |
57 | 57 | ||
58 | $bn_mulw_obj=''; | 58 | $bn_mulw_obj=''; |
59 | $bn_mulw_src=''; | 59 | $bn_mulw_src=''; |
diff --git a/src/lib/libcrypto/util/pl/Mingw32.pl b/src/lib/libcrypto/util/pl/Mingw32.pl index 45ab685974..043a3a53ee 100644 --- a/src/lib/libcrypto/util/pl/Mingw32.pl +++ b/src/lib/libcrypto/util/pl/Mingw32.pl | |||
@@ -1,17 +1,17 @@ | |||
1 | #!/usr/local/bin/perl | 1 | #!/usr/local/bin/perl |
2 | # | 2 | # |
3 | # Mingw32.pl -- Mingw32 with GNU cp (Mingw32f.pl uses DOS tools) | 3 | # Mingw32.pl -- Mingw |
4 | # | 4 | # |
5 | 5 | ||
6 | $o='/'; | 6 | $o='/'; |
7 | $cp='cp'; | 7 | $cp='cp'; |
8 | $rm='rem'; # use 'rm -f' if using GNU file utilities | 8 | $rm='rm -f'; |
9 | $mkdir='gmkdir'; | 9 | $mkdir='gmkdir'; |
10 | 10 | ||
11 | # gcc wouldn't accept backslashes in paths | 11 | $o='\\'; |
12 | #$o='\\'; | 12 | $cp='copy'; |
13 | #$cp='copy'; | 13 | $rm='del'; |
14 | #$rm='del'; | 14 | $mkdir='mkdir'; |
15 | 15 | ||
16 | # C compiler stuff | 16 | # C compiler stuff |
17 | 17 | ||
@@ -19,29 +19,29 @@ $cc='gcc'; | |||
19 | if ($debug) | 19 | if ($debug) |
20 | { $cflags="-DL_ENDIAN -DDSO_WIN32 -g2 -ggdb"; } | 20 | { $cflags="-DL_ENDIAN -DDSO_WIN32 -g2 -ggdb"; } |
21 | else | 21 | else |
22 | { $cflags="-DL_ENDIAN -DDSO_WIN32 -fomit-frame-pointer -O3 -m486 -Wall"; } | 22 | { $cflags="-DL_ENDIAN -DDSO_WIN32 -fomit-frame-pointer -O3 -mcpu=i486 -Wall"; } |
23 | 23 | ||
24 | if ($gaswin and !$no_asm) | 24 | if ($gaswin and !$no_asm) |
25 | { | 25 | { |
26 | $bn_asm_obj='$(OBJ_D)/bn-win32.o'; | 26 | $bn_asm_obj='$(OBJ_D)\bn-win32.o'; |
27 | $bn_asm_src='crypto/bn/asm/bn-win32.s'; | 27 | $bn_asm_src='crypto/bn/asm/bn-win32.s'; |
28 | $bnco_asm_obj='$(OBJ_D)/co-win32.o'; | 28 | $bnco_asm_obj='$(OBJ_D)\co-win32.o'; |
29 | $bnco_asm_src='crypto/bn/asm/co-win32.s'; | 29 | $bnco_asm_src='crypto/bn/asm/co-win32.s'; |
30 | $des_enc_obj='$(OBJ_D)/d-win32.o $(OBJ_D)/y-win32.o'; | 30 | $des_enc_obj='$(OBJ_D)\d-win32.o $(OBJ_D)\y-win32.o'; |
31 | $des_enc_src='crypto/des/asm/d-win32.s crypto/des/asm/y-win32.s'; | 31 | $des_enc_src='crypto/des/asm/d-win32.s crypto/des/asm/y-win32.s'; |
32 | $bf_enc_obj='$(OBJ_D)/b-win32.o'; | 32 | $bf_enc_obj='$(OBJ_D)\b-win32.o'; |
33 | $bf_enc_src='crypto/bf/asm/b-win32.s'; | 33 | $bf_enc_src='crypto/bf/asm/b-win32.s'; |
34 | # $cast_enc_obj='$(OBJ_D)/c-win32.o'; | 34 | # $cast_enc_obj='$(OBJ_D)\c-win32.o'; |
35 | # $cast_enc_src='crypto/cast/asm/c-win32.s'; | 35 | # $cast_enc_src='crypto/cast/asm/c-win32.s'; |
36 | $rc4_enc_obj='$(OBJ_D)/r4-win32.o'; | 36 | $rc4_enc_obj='$(OBJ_D)\r4-win32.o'; |
37 | $rc4_enc_src='crypto/rc4/asm/r4-win32.s'; | 37 | $rc4_enc_src='crypto/rc4/asm/r4-win32.s'; |
38 | $rc5_enc_obj='$(OBJ_D)/r5-win32.o'; | 38 | $rc5_enc_obj='$(OBJ_D)\r5-win32.o'; |
39 | $rc5_enc_src='crypto/rc5/asm/r5-win32.s'; | 39 | $rc5_enc_src='crypto/rc5/asm/r5-win32.s'; |
40 | $md5_asm_obj='$(OBJ_D)/m5-win32.o'; | 40 | $md5_asm_obj='$(OBJ_D)\m5-win32.o'; |
41 | $md5_asm_src='crypto/md5/asm/m5-win32.s'; | 41 | $md5_asm_src='crypto/md5/asm/m5-win32.s'; |
42 | $rmd160_asm_obj='$(OBJ_D)/rm-win32.o'; | 42 | $rmd160_asm_obj='$(OBJ_D)\rm-win32.o'; |
43 | $rmd160_asm_src='crypto/ripemd/asm/rm-win32.s'; | 43 | $rmd160_asm_src='crypto/ripemd/asm/rm-win32.s'; |
44 | $sha1_asm_obj='$(OBJ_D)/s1-win32.o'; | 44 | $sha1_asm_obj='$(OBJ_D)\s1-win32.o'; |
45 | $sha1_asm_src='crypto/sha/asm/s1-win32.s'; | 45 | $sha1_asm_src='crypto/sha/asm/s1-win32.s'; |
46 | $cflags.=" -DBN_ASM -DMD5_ASM -DSHA1_ASM"; | 46 | $cflags.=" -DBN_ASM -DMD5_ASM -DSHA1_ASM"; |
47 | } | 47 | } |
diff --git a/src/lib/libcrypto/util/pl/VC-32.pl b/src/lib/libcrypto/util/pl/VC-32.pl index d6e3a11530..285990c589 100644 --- a/src/lib/libcrypto/util/pl/VC-32.pl +++ b/src/lib/libcrypto/util/pl/VC-32.pl | |||
@@ -91,7 +91,7 @@ if ($shlib) | |||
91 | { | 91 | { |
92 | $mlflags.=" $lflags /dll"; | 92 | $mlflags.=" $lflags /dll"; |
93 | # $cflags =~ s| /MD| /MT|; | 93 | # $cflags =~ s| /MD| /MT|; |
94 | $lib_cflag=" -D_WINDLL -D_DLL"; | 94 | $lib_cflag=" -D_WINDLL"; |
95 | $out_def="out32dll"; | 95 | $out_def="out32dll"; |
96 | $tmp_def="tmp32dll"; | 96 | $tmp_def="tmp32dll"; |
97 | } | 97 | } |
diff --git a/src/lib/libcrypto/util/pl/VC-CE.pl b/src/lib/libcrypto/util/pl/VC-CE.pl new file mode 100644 index 0000000000..1805ef9d97 --- /dev/null +++ b/src/lib/libcrypto/util/pl/VC-CE.pl | |||
@@ -0,0 +1,111 @@ | |||
1 | #!/usr/local/bin/perl | ||
2 | # VC-CE.pl - the file for eMbedded Visual C++ 3.0 for windows CE, static libraries | ||
3 | # | ||
4 | |||
5 | $ssl= "ssleay32"; | ||
6 | $crypto="libeay32"; | ||
7 | $RSAref="RSAref32"; | ||
8 | |||
9 | $o='\\'; | ||
10 | $cp='copy nul+'; # Timestamps get stuffed otherwise | ||
11 | $rm='del'; | ||
12 | |||
13 | # C compiler stuff | ||
14 | $cc='$(CC)'; | ||
15 | $cflags=' /W3 /WX /Ox /O2 /Ob2 /Gs0 /GF /Gy /nologo $(WCETARGETDEFS) -DUNICODE -D_UNICODE -DWIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DDSO_WIN32 -DNO_CHMOD -I$(WCECOMPAT)/include'; | ||
16 | $lflags='/nologo /subsystem:windowsce,$(WCELDVERSION) /machine:$(WCELDMACHINE) /opt:ref'; | ||
17 | $mlflags=''; | ||
18 | |||
19 | $out_def='out32_$(TARGETCPU)'; | ||
20 | $tmp_def='tmp32_$(TARGETCPU)'; | ||
21 | $inc_def="inc32"; | ||
22 | |||
23 | if ($debug) | ||
24 | { | ||
25 | $cflags=" /MDd /W3 /WX /Zi /Yd /Od /nologo -DWIN32 -D_DEBUG -DL_ENDIAN -DWIN32_LEAN_AND_MEAN -DDEBUG -DDSO_WIN32"; | ||
26 | $lflags.=" /debug"; | ||
27 | $mlflags.=' /debug'; | ||
28 | } | ||
29 | |||
30 | $obj='.obj'; | ||
31 | $ofile="/Fo"; | ||
32 | |||
33 | # EXE linking stuff | ||
34 | $link="link"; | ||
35 | $efile="/out:"; | ||
36 | $exep='.exe'; | ||
37 | if ($no_sock) | ||
38 | { $ex_libs=""; } | ||
39 | else { $ex_libs='winsock.lib $(WCECOMPAT)/lib/wcecompatex.lib $(WCELDFLAGS)'; } | ||
40 | |||
41 | # static library stuff | ||
42 | $mklib='lib'; | ||
43 | $ranlib=''; | ||
44 | $plib=""; | ||
45 | $libp=".lib"; | ||
46 | $shlibp=($shlib)?".dll":".lib"; | ||
47 | $lfile='/out:'; | ||
48 | |||
49 | $shlib_ex_obj=""; | ||
50 | #$app_ex_obj="setargv.obj"; | ||
51 | $app_ex_obj=""; | ||
52 | |||
53 | $bn_asm_obj=''; | ||
54 | $bn_asm_src=''; | ||
55 | $des_enc_obj=''; | ||
56 | $des_enc_src=''; | ||
57 | $bf_enc_obj=''; | ||
58 | $bf_enc_src=''; | ||
59 | |||
60 | if ($shlib) | ||
61 | { | ||
62 | $mlflags.=" $lflags /dll"; | ||
63 | # $cflags =~ s| /MD| /MT|; | ||
64 | $lib_cflag=" -D_WINDLL -D_DLL"; | ||
65 | $out_def='out32dll_$(TARGETCPU)'; | ||
66 | $tmp_def='tmp32dll_$(TARGETCPU)'; | ||
67 | } | ||
68 | |||
69 | $cflags.=" /Fd$out_def"; | ||
70 | |||
71 | sub do_lib_rule | ||
72 | { | ||
73 | local($objs,$target,$name,$shlib)=@_; | ||
74 | local($ret,$Name); | ||
75 | |||
76 | $taget =~ s/\//$o/g if $o ne '/'; | ||
77 | ($Name=$name) =~ tr/a-z/A-Z/; | ||
78 | |||
79 | # $target="\$(LIB_D)$o$target"; | ||
80 | $ret.="$target: $objs\n"; | ||
81 | if (!$shlib) | ||
82 | { | ||
83 | # $ret.="\t\$(RM) \$(O_$Name)\n"; | ||
84 | $ex =' '; | ||
85 | $ret.="\t\$(MKLIB) $lfile$target @<<\n $objs $ex\n<<\n"; | ||
86 | } | ||
87 | else | ||
88 | { | ||
89 | local($ex)=($target =~ /O_SSL/)?' $(L_CRYPTO)':''; | ||
90 | # $ex.=' winsock.lib coredll.lib $(WCECOMPAT)/lib/wcecompatex.lib'; | ||
91 | $ex.=' winsock.lib $(WCECOMPAT)/lib/wcecompatex.lib'; | ||
92 | $ret.="\t\$(LINK) \$(MLFLAGS) $efile$target /def:ms/${Name}.def @<<\n \$(SHLIB_EX_OBJ) $objs $ex\n<<\n"; | ||
93 | } | ||
94 | $ret.="\n"; | ||
95 | return($ret); | ||
96 | } | ||
97 | |||
98 | sub do_link_rule | ||
99 | { | ||
100 | local($target,$files,$dep_libs,$libs)=@_; | ||
101 | local($ret,$_); | ||
102 | |||
103 | $file =~ s/\//$o/g if $o ne '/'; | ||
104 | $n=&bname($targer); | ||
105 | $ret.="$target: $files $dep_libs\n"; | ||
106 | $ret.=" \$(LINK) \$(LFLAGS) $efile$target @<<\n"; | ||
107 | $ret.=" \$(APP_EX_OBJ) $files $libs\n<<\n\n"; | ||
108 | return($ret); | ||
109 | } | ||
110 | |||
111 | 1; | ||
diff --git a/src/lib/libcrypto/util/ssleay.num b/src/lib/libcrypto/util/ssleay.num index fdea47205d..46e38a131f 100644 --- a/src/lib/libcrypto/util/ssleay.num +++ b/src/lib/libcrypto/util/ssleay.num | |||
@@ -169,7 +169,7 @@ SSL_add_file_cert_subjects_to_stack 185 EXIST:!VMS:FUNCTION:STDIO | |||
169 | SSL_add_file_cert_subjs_to_stk 185 EXIST:VMS:FUNCTION:STDIO | 169 | SSL_add_file_cert_subjs_to_stk 185 EXIST:VMS:FUNCTION:STDIO |
170 | SSL_set_tmp_rsa_callback 186 EXIST::FUNCTION:RSA | 170 | SSL_set_tmp_rsa_callback 186 EXIST::FUNCTION:RSA |
171 | SSL_set_tmp_dh_callback 187 EXIST::FUNCTION:DH | 171 | SSL_set_tmp_dh_callback 187 EXIST::FUNCTION:DH |
172 | SSL_add_dir_cert_subjects_to_stack 188 EXIST:!VMS,!WIN32:FUNCTION:STDIO | 172 | SSL_add_dir_cert_subjects_to_stack 188 EXIST:!VMS:FUNCTION:STDIO |
173 | SSL_add_dir_cert_subjs_to_stk 188 NOEXIST::FUNCTION: | 173 | SSL_add_dir_cert_subjs_to_stk 188 NOEXIST::FUNCTION: |
174 | SSL_set_session_id_context 189 EXIST::FUNCTION: | 174 | SSL_set_session_id_context 189 EXIST::FUNCTION: |
175 | SSL_CTX_use_certificate_chain_file 222 EXIST:!VMS:FUNCTION:STDIO | 175 | SSL_CTX_use_certificate_chain_file 222 EXIST:!VMS:FUNCTION:STDIO |
diff --git a/src/lib/libcrypto/x509v3/v3conf.c b/src/lib/libcrypto/x509v3/v3conf.c index 67ee14f334..00cf5b4a5b 100644 --- a/src/lib/libcrypto/x509v3/v3conf.c +++ b/src/lib/libcrypto/x509v3/v3conf.c | |||
@@ -118,7 +118,7 @@ int main(int argc, char **argv) | |||
118 | printf("%s", OBJ_nid2ln(OBJ_obj2nid(ext->object))); | 118 | printf("%s", OBJ_nid2ln(OBJ_obj2nid(ext->object))); |
119 | if(ext->critical) printf(",critical:\n"); | 119 | if(ext->critical) printf(",critical:\n"); |
120 | else printf(":\n"); | 120 | else printf(":\n"); |
121 | X509V3_EXT_print_fp(stdout, ext, 0); | 121 | X509V3_EXT_print_fp(stdout, ext, 0, 0); |
122 | printf("\n"); | 122 | printf("\n"); |
123 | 123 | ||
124 | } | 124 | } |