diff options
author | markus <> | 2004-04-07 20:42:12 +0000 |
---|---|---|
committer | markus <> | 2004-04-07 20:42:12 +0000 |
commit | 00b426069b0dfa8f0d9b87308646e9684f45c515 (patch) | |
tree | 2eb0df944a8ed229c1d2a165679566e87ce34575 /src/lib/libcrypto | |
parent | fd84abe5019daf5a6869e1d12702e3e11b7a81bc (diff) | |
download | openbsd-00b426069b0dfa8f0d9b87308646e9684f45c515.tar.gz openbsd-00b426069b0dfa8f0d9b87308646e9684f45c515.tar.bz2 openbsd-00b426069b0dfa8f0d9b87308646e9684f45c515.zip |
import openssl-0.9.7d
Diffstat (limited to 'src/lib/libcrypto')
-rw-r--r-- | src/lib/libcrypto/asn1/a_gentm.c | 9 | ||||
-rw-r--r-- | src/lib/libcrypto/asn1/a_utctm.c | 9 | ||||
-rw-r--r-- | src/lib/libcrypto/engine/hw_cryptodev.c | 9 | ||||
-rw-r--r-- | src/lib/libcrypto/evp/bio_ok.c | 2 | ||||
-rw-r--r-- | src/lib/libcrypto/mem.c | 18 | ||||
-rw-r--r-- | src/lib/libcrypto/rand/rand_egd.c | 3 | ||||
-rw-r--r-- | src/lib/libcrypto/rand/rand_unix.c | 19 | ||||
-rw-r--r-- | src/lib/libcrypto/rand/rand_win.c | 2 | ||||
-rw-r--r-- | src/lib/libcrypto/rc5/rc5_locl.h | 207 | ||||
-rw-r--r-- | src/lib/libcrypto/threads/mttest.c | 3 | ||||
-rw-r--r-- | src/lib/libcrypto/util/extract-names.pl | 2 | ||||
-rw-r--r-- | src/lib/libcrypto/util/mk1mf.pl | 2 | ||||
-rw-r--r-- | src/lib/libcrypto/util/mkdef.pl | 38 | ||||
-rw-r--r-- | src/lib/libcrypto/util/pl/OS2-EMX.pl | 42 |
14 files changed, 316 insertions, 49 deletions
diff --git a/src/lib/libcrypto/asn1/a_gentm.c b/src/lib/libcrypto/asn1/a_gentm.c index cd09f68b38..8581007868 100644 --- a/src/lib/libcrypto/asn1/a_gentm.c +++ b/src/lib/libcrypto/asn1/a_gentm.c | |||
@@ -208,6 +208,7 @@ ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s, | |||
208 | char *p; | 208 | char *p; |
209 | struct tm *ts; | 209 | struct tm *ts; |
210 | struct tm data; | 210 | struct tm data; |
211 | size_t len = 20; | ||
211 | 212 | ||
212 | if (s == NULL) | 213 | if (s == NULL) |
213 | s=M_ASN1_GENERALIZEDTIME_new(); | 214 | s=M_ASN1_GENERALIZEDTIME_new(); |
@@ -219,17 +220,17 @@ ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s, | |||
219 | return(NULL); | 220 | return(NULL); |
220 | 221 | ||
221 | p=(char *)s->data; | 222 | p=(char *)s->data; |
222 | if ((p == NULL) || (s->length < 16)) | 223 | if ((p == NULL) || ((size_t)s->length < len)) |
223 | { | 224 | { |
224 | p=OPENSSL_malloc(20); | 225 | p=OPENSSL_malloc(len); |
225 | if (p == NULL) return(NULL); | 226 | if (p == NULL) return(NULL); |
226 | if (s->data != NULL) | 227 | if (s->data != NULL) |
227 | OPENSSL_free(s->data); | 228 | OPENSSL_free(s->data); |
228 | s->data=(unsigned char *)p; | 229 | s->data=(unsigned char *)p; |
229 | } | 230 | } |
230 | 231 | ||
231 | sprintf(p,"%04d%02d%02d%02d%02d%02dZ",ts->tm_year + 1900, | 232 | BIO_snprintf(p,len,"%04d%02d%02d%02d%02d%02dZ",ts->tm_year + 1900, |
232 | ts->tm_mon+1,ts->tm_mday,ts->tm_hour,ts->tm_min,ts->tm_sec); | 233 | ts->tm_mon+1,ts->tm_mday,ts->tm_hour,ts->tm_min,ts->tm_sec); |
233 | s->length=strlen(p); | 234 | s->length=strlen(p); |
234 | s->type=V_ASN1_GENERALIZEDTIME; | 235 | s->type=V_ASN1_GENERALIZEDTIME; |
235 | #ifdef CHARSET_EBCDIC_not | 236 | #ifdef CHARSET_EBCDIC_not |
diff --git a/src/lib/libcrypto/asn1/a_utctm.c b/src/lib/libcrypto/asn1/a_utctm.c index dbb4a42c9d..999852dae5 100644 --- a/src/lib/libcrypto/asn1/a_utctm.c +++ b/src/lib/libcrypto/asn1/a_utctm.c | |||
@@ -188,6 +188,7 @@ ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s, time_t t) | |||
188 | char *p; | 188 | char *p; |
189 | struct tm *ts; | 189 | struct tm *ts; |
190 | struct tm data; | 190 | struct tm data; |
191 | size_t len = 20; | ||
191 | 192 | ||
192 | if (s == NULL) | 193 | if (s == NULL) |
193 | s=M_ASN1_UTCTIME_new(); | 194 | s=M_ASN1_UTCTIME_new(); |
@@ -199,17 +200,17 @@ ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s, time_t t) | |||
199 | return(NULL); | 200 | return(NULL); |
200 | 201 | ||
201 | p=(char *)s->data; | 202 | p=(char *)s->data; |
202 | if ((p == NULL) || (s->length < 14)) | 203 | if ((p == NULL) || ((size_t)s->length < len)) |
203 | { | 204 | { |
204 | p=OPENSSL_malloc(20); | 205 | p=OPENSSL_malloc(len); |
205 | if (p == NULL) return(NULL); | 206 | if (p == NULL) return(NULL); |
206 | if (s->data != NULL) | 207 | if (s->data != NULL) |
207 | OPENSSL_free(s->data); | 208 | OPENSSL_free(s->data); |
208 | s->data=(unsigned char *)p; | 209 | s->data=(unsigned char *)p; |
209 | } | 210 | } |
210 | 211 | ||
211 | sprintf(p,"%02d%02d%02d%02d%02d%02dZ",ts->tm_year%100, | 212 | BIO_snprintf(p,len,"%02d%02d%02d%02d%02d%02dZ",ts->tm_year%100, |
212 | ts->tm_mon+1,ts->tm_mday,ts->tm_hour,ts->tm_min,ts->tm_sec); | 213 | ts->tm_mon+1,ts->tm_mday,ts->tm_hour,ts->tm_min,ts->tm_sec); |
213 | s->length=strlen(p); | 214 | s->length=strlen(p); |
214 | s->type=V_ASN1_UTCTIME; | 215 | s->type=V_ASN1_UTCTIME; |
215 | #ifdef CHARSET_EBCDIC_not | 216 | #ifdef CHARSET_EBCDIC_not |
diff --git a/src/lib/libcrypto/engine/hw_cryptodev.c b/src/lib/libcrypto/engine/hw_cryptodev.c index 40af97ac24..467c0daa1b 100644 --- a/src/lib/libcrypto/engine/hw_cryptodev.c +++ b/src/lib/libcrypto/engine/hw_cryptodev.c | |||
@@ -12,9 +12,6 @@ | |||
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in the | 13 | * notice, this list of conditions and the following disclaimer in the |
14 | * documentation and/or other materials provided with the distribution. | 14 | * documentation and/or other materials provided with the distribution. |
15 | * 3. Neither the name of the author nor the names of contributors | ||
16 | * may be used to endorse or promote products derived from this software | ||
17 | * without specific prior written permission. | ||
18 | * | 15 | * |
19 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY |
20 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
@@ -874,7 +871,6 @@ cryptodev_dsa_do_sign(const unsigned char *dgst, int dlen, DSA *dsa) | |||
874 | goto err; | 871 | goto err; |
875 | } | 872 | } |
876 | 873 | ||
877 | printf("bar\n"); | ||
878 | memset(&kop, 0, sizeof kop); | 874 | memset(&kop, 0, sizeof kop); |
879 | kop.crk_op = CRK_DSA_SIGN; | 875 | kop.crk_op = CRK_DSA_SIGN; |
880 | 876 | ||
@@ -1054,14 +1050,17 @@ ENGINE_load_cryptodev(void) | |||
1054 | 1050 | ||
1055 | if (engine == NULL) | 1051 | if (engine == NULL) |
1056 | return; | 1052 | return; |
1057 | if ((fd = get_dev_crypto()) < 0) | 1053 | if ((fd = get_dev_crypto()) < 0) { |
1054 | ENGINE_free(engine); | ||
1058 | return; | 1055 | return; |
1056 | } | ||
1059 | 1057 | ||
1060 | /* | 1058 | /* |
1061 | * find out what asymmetric crypto algorithms we support | 1059 | * find out what asymmetric crypto algorithms we support |
1062 | */ | 1060 | */ |
1063 | if (ioctl(fd, CIOCASYMFEAT, &cryptodev_asymfeat) == -1) { | 1061 | if (ioctl(fd, CIOCASYMFEAT, &cryptodev_asymfeat) == -1) { |
1064 | close(fd); | 1062 | close(fd); |
1063 | ENGINE_free(engine); | ||
1065 | return; | 1064 | return; |
1066 | } | 1065 | } |
1067 | close(fd); | 1066 | close(fd); |
diff --git a/src/lib/libcrypto/evp/bio_ok.c b/src/lib/libcrypto/evp/bio_ok.c index 530ab937ce..4e3f10141b 100644 --- a/src/lib/libcrypto/evp/bio_ok.c +++ b/src/lib/libcrypto/evp/bio_ok.c | |||
@@ -102,7 +102,7 @@ | |||
102 | 102 | ||
103 | *) digest is initialized with random seed instead of | 103 | *) digest is initialized with random seed instead of |
104 | standardized one. | 104 | standardized one. |
105 | *) same seed is written to ouput | 105 | *) same seed is written to output |
106 | *) well-known text is then hashed and the output | 106 | *) well-known text is then hashed and the output |
107 | of the digest is also written to output. | 107 | of the digest is also written to output. |
108 | 108 | ||
diff --git a/src/lib/libcrypto/mem.c b/src/lib/libcrypto/mem.c index 29df7d35b2..dd86733b77 100644 --- a/src/lib/libcrypto/mem.c +++ b/src/lib/libcrypto/mem.c | |||
@@ -252,7 +252,7 @@ void *CRYPTO_malloc_locked(int num, const char *file, int line) | |||
252 | void *ret = NULL; | 252 | void *ret = NULL; |
253 | extern unsigned char cleanse_ctr; | 253 | extern unsigned char cleanse_ctr; |
254 | 254 | ||
255 | if (num < 0) return NULL; | 255 | if (num <= 0) return NULL; |
256 | 256 | ||
257 | allow_customize = 0; | 257 | allow_customize = 0; |
258 | if (malloc_debug_func != NULL) | 258 | if (malloc_debug_func != NULL) |
@@ -293,7 +293,7 @@ void *CRYPTO_malloc(int num, const char *file, int line) | |||
293 | void *ret = NULL; | 293 | void *ret = NULL; |
294 | extern unsigned char cleanse_ctr; | 294 | extern unsigned char cleanse_ctr; |
295 | 295 | ||
296 | if (num < 0) return NULL; | 296 | if (num <= 0) return NULL; |
297 | 297 | ||
298 | allow_customize = 0; | 298 | allow_customize = 0; |
299 | if (malloc_debug_func != NULL) | 299 | if (malloc_debug_func != NULL) |
@@ -324,7 +324,7 @@ void *CRYPTO_realloc(void *str, int num, const char *file, int line) | |||
324 | if (str == NULL) | 324 | if (str == NULL) |
325 | return CRYPTO_malloc(num, file, line); | 325 | return CRYPTO_malloc(num, file, line); |
326 | 326 | ||
327 | if (num < 0) return NULL; | 327 | if (num <= 0) return NULL; |
328 | 328 | ||
329 | if (realloc_debug_func != NULL) | 329 | if (realloc_debug_func != NULL) |
330 | realloc_debug_func(str, NULL, num, file, line, 0); | 330 | realloc_debug_func(str, NULL, num, file, line, 0); |
@@ -346,17 +346,21 @@ void *CRYPTO_realloc_clean(void *str, int old_len, int num, const char *file, | |||
346 | if (str == NULL) | 346 | if (str == NULL) |
347 | return CRYPTO_malloc(num, file, line); | 347 | return CRYPTO_malloc(num, file, line); |
348 | 348 | ||
349 | if (num < 0) return NULL; | 349 | if (num <= 0) return NULL; |
350 | 350 | ||
351 | if (realloc_debug_func != NULL) | 351 | if (realloc_debug_func != NULL) |
352 | realloc_debug_func(str, NULL, num, file, line, 0); | 352 | realloc_debug_func(str, NULL, num, file, line, 0); |
353 | ret=malloc_ex_func(num,file,line); | 353 | ret=malloc_ex_func(num,file,line); |
354 | if(ret) | 354 | if(ret) |
355 | { | ||
355 | memcpy(ret,str,old_len); | 356 | memcpy(ret,str,old_len); |
356 | OPENSSL_cleanse(str,old_len); | 357 | OPENSSL_cleanse(str,old_len); |
357 | free_func(str); | 358 | free_func(str); |
359 | } | ||
358 | #ifdef LEVITTE_DEBUG_MEM | 360 | #ifdef LEVITTE_DEBUG_MEM |
359 | fprintf(stderr, "LEVITTE_DEBUG_MEM: | 0x%p -> 0x%p (%d)\n", str, ret, num); | 361 | fprintf(stderr, |
362 | "LEVITTE_DEBUG_MEM: | 0x%p -> 0x%p (%d)\n", | ||
363 | str, ret, num); | ||
360 | #endif | 364 | #endif |
361 | if (realloc_debug_func != NULL) | 365 | if (realloc_debug_func != NULL) |
362 | realloc_debug_func(str, ret, num, file, line, 1); | 366 | realloc_debug_func(str, ret, num, file, line, 1); |
diff --git a/src/lib/libcrypto/rand/rand_egd.c b/src/lib/libcrypto/rand/rand_egd.c index 1f168221e3..6f742900a0 100644 --- a/src/lib/libcrypto/rand/rand_egd.c +++ b/src/lib/libcrypto/rand/rand_egd.c | |||
@@ -56,6 +56,7 @@ | |||
56 | 56 | ||
57 | #include <openssl/e_os2.h> | 57 | #include <openssl/e_os2.h> |
58 | #include <openssl/rand.h> | 58 | #include <openssl/rand.h> |
59 | #include <openssl/buffer.h> | ||
59 | 60 | ||
60 | /* | 61 | /* |
61 | * Query the EGD <URL: http://www.lothar.com/tech/crypto/>. | 62 | * Query the EGD <URL: http://www.lothar.com/tech/crypto/>. |
@@ -145,7 +146,7 @@ int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes) | |||
145 | addr.sun_family = AF_UNIX; | 146 | addr.sun_family = AF_UNIX; |
146 | if (strlen(path) >= sizeof(addr.sun_path)) | 147 | if (strlen(path) >= sizeof(addr.sun_path)) |
147 | return (-1); | 148 | return (-1); |
148 | strcpy(addr.sun_path,path); | 149 | BUF_strlcpy(addr.sun_path,path,sizeof addr.sun_path); |
149 | len = offsetof(struct sockaddr_un, sun_path) + strlen(path); | 150 | len = offsetof(struct sockaddr_un, sun_path) + strlen(path); |
150 | fd = socket(AF_UNIX, SOCK_STREAM, 0); | 151 | fd = socket(AF_UNIX, SOCK_STREAM, 0); |
151 | if (fd == -1) return (-1); | 152 | if (fd == -1) return (-1); |
diff --git a/src/lib/libcrypto/rand/rand_unix.c b/src/lib/libcrypto/rand/rand_unix.c index a776e52243..0599719dd1 100644 --- a/src/lib/libcrypto/rand/rand_unix.c +++ b/src/lib/libcrypto/rand/rand_unix.c | |||
@@ -124,6 +124,24 @@ | |||
124 | #include <unistd.h> | 124 | #include <unistd.h> |
125 | #include <time.h> | 125 | #include <time.h> |
126 | 126 | ||
127 | #ifdef __OpenBSD__ | ||
128 | int RAND_poll(void) | ||
129 | { | ||
130 | u_int32_t rnd = 0, i; | ||
131 | unsigned char buf[ENTROPY_NEEDED]; | ||
132 | |||
133 | for (i = 0; i < sizeof(buf); i++) { | ||
134 | if (i % 4 == 0) | ||
135 | rnd = arc4random(); | ||
136 | buf[i] = rnd; | ||
137 | rnd >>= 8; | ||
138 | } | ||
139 | RAND_add(buf, sizeof(buf), ENTROPY_NEEDED); | ||
140 | memset(buf, 0, sizeof(buf)); | ||
141 | |||
142 | return 1; | ||
143 | } | ||
144 | #else | ||
127 | int RAND_poll(void) | 145 | int RAND_poll(void) |
128 | { | 146 | { |
129 | unsigned long l; | 147 | unsigned long l; |
@@ -236,6 +254,7 @@ int RAND_poll(void) | |||
236 | } | 254 | } |
237 | 255 | ||
238 | #endif | 256 | #endif |
257 | #endif | ||
239 | 258 | ||
240 | #if defined(OPENSSL_SYS_VXWORKS) | 259 | #if defined(OPENSSL_SYS_VXWORKS) |
241 | int RAND_poll(void) | 260 | int RAND_poll(void) |
diff --git a/src/lib/libcrypto/rand/rand_win.c b/src/lib/libcrypto/rand/rand_win.c index 263068d256..3584842224 100644 --- a/src/lib/libcrypto/rand/rand_win.c +++ b/src/lib/libcrypto/rand/rand_win.c | |||
@@ -646,7 +646,7 @@ static void readtimer(void) | |||
646 | * Created 960901 by Gertjan van Oosten, gertjan@West.NL, West Consulting B.V. | 646 | * Created 960901 by Gertjan van Oosten, gertjan@West.NL, West Consulting B.V. |
647 | * | 647 | * |
648 | * Code adapted from | 648 | * Code adapted from |
649 | * <URL:http://www.microsoft.com/kb/developr/win_dk/q97193.htm>; | 649 | * <URL:http://support.microsoft.com/default.aspx?scid=kb;[LN];97193>; |
650 | * the original copyright message is: | 650 | * the original copyright message is: |
651 | * | 651 | * |
652 | * (C) Copyright Microsoft Corp. 1993. All rights reserved. | 652 | * (C) Copyright Microsoft Corp. 1993. All rights reserved. |
diff --git a/src/lib/libcrypto/rc5/rc5_locl.h b/src/lib/libcrypto/rc5/rc5_locl.h new file mode 100644 index 0000000000..f4ebc23004 --- /dev/null +++ b/src/lib/libcrypto/rc5/rc5_locl.h | |||
@@ -0,0 +1,207 @@ | |||
1 | /* crypto/rc5/rc5_locl.h */ | ||
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 <stdlib.h> | ||
60 | |||
61 | #undef c2l | ||
62 | #define c2l(c,l) (l =((unsigned long)(*((c)++))) , \ | ||
63 | l|=((unsigned long)(*((c)++)))<< 8L, \ | ||
64 | l|=((unsigned long)(*((c)++)))<<16L, \ | ||
65 | l|=((unsigned long)(*((c)++)))<<24L) | ||
66 | |||
67 | /* NOTE - c is not incremented as per c2l */ | ||
68 | #undef c2ln | ||
69 | #define c2ln(c,l1,l2,n) { \ | ||
70 | c+=n; \ | ||
71 | l1=l2=0; \ | ||
72 | switch (n) { \ | ||
73 | case 8: l2 =((unsigned long)(*(--(c))))<<24L; \ | ||
74 | case 7: l2|=((unsigned long)(*(--(c))))<<16L; \ | ||
75 | case 6: l2|=((unsigned long)(*(--(c))))<< 8L; \ | ||
76 | case 5: l2|=((unsigned long)(*(--(c)))); \ | ||
77 | case 4: l1 =((unsigned long)(*(--(c))))<<24L; \ | ||
78 | case 3: l1|=((unsigned long)(*(--(c))))<<16L; \ | ||
79 | case 2: l1|=((unsigned long)(*(--(c))))<< 8L; \ | ||
80 | case 1: l1|=((unsigned long)(*(--(c)))); \ | ||
81 | } \ | ||
82 | } | ||
83 | |||
84 | #undef l2c | ||
85 | #define l2c(l,c) (*((c)++)=(unsigned char)(((l) )&0xff), \ | ||
86 | *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \ | ||
87 | *((c)++)=(unsigned char)(((l)>>16L)&0xff), \ | ||
88 | *((c)++)=(unsigned char)(((l)>>24L)&0xff)) | ||
89 | |||
90 | /* NOTE - c is not incremented as per l2c */ | ||
91 | #undef l2cn | ||
92 | #define l2cn(l1,l2,c,n) { \ | ||
93 | c+=n; \ | ||
94 | switch (n) { \ | ||
95 | case 8: *(--(c))=(unsigned char)(((l2)>>24L)&0xff); \ | ||
96 | case 7: *(--(c))=(unsigned char)(((l2)>>16L)&0xff); \ | ||
97 | case 6: *(--(c))=(unsigned char)(((l2)>> 8L)&0xff); \ | ||
98 | case 5: *(--(c))=(unsigned char)(((l2) )&0xff); \ | ||
99 | case 4: *(--(c))=(unsigned char)(((l1)>>24L)&0xff); \ | ||
100 | case 3: *(--(c))=(unsigned char)(((l1)>>16L)&0xff); \ | ||
101 | case 2: *(--(c))=(unsigned char)(((l1)>> 8L)&0xff); \ | ||
102 | case 1: *(--(c))=(unsigned char)(((l1) )&0xff); \ | ||
103 | } \ | ||
104 | } | ||
105 | |||
106 | /* NOTE - c is not incremented as per n2l */ | ||
107 | #define n2ln(c,l1,l2,n) { \ | ||
108 | c+=n; \ | ||
109 | l1=l2=0; \ | ||
110 | switch (n) { \ | ||
111 | case 8: l2 =((unsigned long)(*(--(c)))) ; \ | ||
112 | case 7: l2|=((unsigned long)(*(--(c))))<< 8; \ | ||
113 | case 6: l2|=((unsigned long)(*(--(c))))<<16; \ | ||
114 | case 5: l2|=((unsigned long)(*(--(c))))<<24; \ | ||
115 | case 4: l1 =((unsigned long)(*(--(c)))) ; \ | ||
116 | case 3: l1|=((unsigned long)(*(--(c))))<< 8; \ | ||
117 | case 2: l1|=((unsigned long)(*(--(c))))<<16; \ | ||
118 | case 1: l1|=((unsigned long)(*(--(c))))<<24; \ | ||
119 | } \ | ||
120 | } | ||
121 | |||
122 | /* NOTE - c is not incremented as per l2n */ | ||
123 | #define l2nn(l1,l2,c,n) { \ | ||
124 | c+=n; \ | ||
125 | switch (n) { \ | ||
126 | case 8: *(--(c))=(unsigned char)(((l2) )&0xff); \ | ||
127 | case 7: *(--(c))=(unsigned char)(((l2)>> 8)&0xff); \ | ||
128 | case 6: *(--(c))=(unsigned char)(((l2)>>16)&0xff); \ | ||
129 | case 5: *(--(c))=(unsigned char)(((l2)>>24)&0xff); \ | ||
130 | case 4: *(--(c))=(unsigned char)(((l1) )&0xff); \ | ||
131 | case 3: *(--(c))=(unsigned char)(((l1)>> 8)&0xff); \ | ||
132 | case 2: *(--(c))=(unsigned char)(((l1)>>16)&0xff); \ | ||
133 | case 1: *(--(c))=(unsigned char)(((l1)>>24)&0xff); \ | ||
134 | } \ | ||
135 | } | ||
136 | |||
137 | #undef n2l | ||
138 | #define n2l(c,l) (l =((unsigned long)(*((c)++)))<<24L, \ | ||
139 | l|=((unsigned long)(*((c)++)))<<16L, \ | ||
140 | l|=((unsigned long)(*((c)++)))<< 8L, \ | ||
141 | l|=((unsigned long)(*((c)++)))) | ||
142 | |||
143 | #undef l2n | ||
144 | #define l2n(l,c) (*((c)++)=(unsigned char)(((l)>>24L)&0xff), \ | ||
145 | *((c)++)=(unsigned char)(((l)>>16L)&0xff), \ | ||
146 | *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \ | ||
147 | *((c)++)=(unsigned char)(((l) )&0xff)) | ||
148 | |||
149 | #if defined(OPENSSL_SYS_WIN32) && defined(_MSC_VER) | ||
150 | #define ROTATE_l32(a,n) _lrotl(a,n) | ||
151 | #define ROTATE_r32(a,n) _lrotr(a,n) | ||
152 | #elif defined(__GNUC__) && __GNUC__>=2 && !defined(__STRICT_ANSI__) && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM) && !defined(PEDANTIC) | ||
153 | # if defined(__i386) || defined(__i386__) || defined(__x86_64) || defined(__x86_64__) | ||
154 | # define ROTATE_l32(a,n) ({ register unsigned int ret; \ | ||
155 | asm ("roll %%cl,%0" \ | ||
156 | : "=r"(ret) \ | ||
157 | : "c"(n),"0"(a) \ | ||
158 | : "cc"); \ | ||
159 | ret; \ | ||
160 | }) | ||
161 | # define ROTATE_r32(a,n) ({ register unsigned int ret; \ | ||
162 | asm ("rorl %%cl,%0" \ | ||
163 | : "=r"(ret) \ | ||
164 | : "c"(n),"0"(a) \ | ||
165 | : "cc"); \ | ||
166 | ret; \ | ||
167 | }) | ||
168 | # endif | ||
169 | #endif | ||
170 | #ifndef ROTATE_l32 | ||
171 | #define ROTATE_l32(a,n) (((a)<<(n&0x1f))|(((a)&0xffffffff)>>(32-(n&0x1f)))) | ||
172 | #endif | ||
173 | #ifndef ROTATE_r32 | ||
174 | #define ROTATE_r32(a,n) (((a)<<(32-(n&0x1f)))|(((a)&0xffffffff)>>(n&0x1f))) | ||
175 | #endif | ||
176 | |||
177 | #define RC5_32_MASK 0xffffffffL | ||
178 | |||
179 | #define RC5_16_P 0xB7E1 | ||
180 | #define RC5_16_Q 0x9E37 | ||
181 | #define RC5_32_P 0xB7E15163L | ||
182 | #define RC5_32_Q 0x9E3779B9L | ||
183 | #define RC5_64_P 0xB7E151628AED2A6BLL | ||
184 | #define RC5_64_Q 0x9E3779B97F4A7C15LL | ||
185 | |||
186 | #define E_RC5_32(a,b,s,n) \ | ||
187 | a^=b; \ | ||
188 | a=ROTATE_l32(a,b); \ | ||
189 | a+=s[n]; \ | ||
190 | a&=RC5_32_MASK; \ | ||
191 | b^=a; \ | ||
192 | b=ROTATE_l32(b,a); \ | ||
193 | b+=s[n+1]; \ | ||
194 | b&=RC5_32_MASK; | ||
195 | |||
196 | #define D_RC5_32(a,b,s,n) \ | ||
197 | b-=s[n+1]; \ | ||
198 | b&=RC5_32_MASK; \ | ||
199 | b=ROTATE_r32(b,a); \ | ||
200 | b^=a; \ | ||
201 | a-=s[n]; \ | ||
202 | a&=RC5_32_MASK; \ | ||
203 | a=ROTATE_r32(a,b); \ | ||
204 | a^=b; | ||
205 | |||
206 | |||
207 | |||
diff --git a/src/lib/libcrypto/threads/mttest.c b/src/lib/libcrypto/threads/mttest.c index 54d598565d..7588966cb2 100644 --- a/src/lib/libcrypto/threads/mttest.c +++ b/src/lib/libcrypto/threads/mttest.c | |||
@@ -243,7 +243,8 @@ bad: | |||
243 | goto end; | 243 | goto end; |
244 | } | 244 | } |
245 | 245 | ||
246 | if (cipher == NULL) cipher=getenv("SSL_CIPHER"); | 246 | if (cipher == NULL && OPENSSL_issetugid() == 0) |
247 | cipher=getenv("SSL_CIPHER"); | ||
247 | 248 | ||
248 | SSL_load_error_strings(); | 249 | SSL_load_error_strings(); |
249 | OpenSSL_add_ssl_algorithms(); | 250 | OpenSSL_add_ssl_algorithms(); |
diff --git a/src/lib/libcrypto/util/extract-names.pl b/src/lib/libcrypto/util/extract-names.pl index 9f2ad5ef16..744a8e2324 100644 --- a/src/lib/libcrypto/util/extract-names.pl +++ b/src/lib/libcrypto/util/extract-names.pl | |||
@@ -10,6 +10,8 @@ while(<STDIN>) { | |||
10 | if (/ - /) { | 10 | if (/ - /) { |
11 | s/ - .*//; | 11 | s/ - .*//; |
12 | s/,[ \t]+/,/g; | 12 | s/,[ \t]+/,/g; |
13 | s/^[ \t]+//g; | ||
14 | s/[ \t]+$//g; | ||
13 | push @words, split ','; | 15 | push @words, split ','; |
14 | } | 16 | } |
15 | } | 17 | } |
diff --git a/src/lib/libcrypto/util/mk1mf.pl b/src/lib/libcrypto/util/mk1mf.pl index c538f9dffb..b4bc0457e5 100644 --- a/src/lib/libcrypto/util/mk1mf.pl +++ b/src/lib/libcrypto/util/mk1mf.pl | |||
@@ -277,6 +277,8 @@ $defs= <<"EOF"; | |||
277 | 277 | ||
278 | EOF | 278 | EOF |
279 | 279 | ||
280 | $defs .= $preamble if defined $preamble; | ||
281 | |||
280 | if ($platform eq "VC-CE") | 282 | if ($platform eq "VC-CE") |
281 | { | 283 | { |
282 | $defs.= <<"EOF"; | 284 | $defs.= <<"EOF"; |
diff --git a/src/lib/libcrypto/util/mkdef.pl b/src/lib/libcrypto/util/mkdef.pl index cdd2164c4e..01a1bfda19 100644 --- a/src/lib/libcrypto/util/mkdef.pl +++ b/src/lib/libcrypto/util/mkdef.pl | |||
@@ -1116,27 +1116,55 @@ sub print_test_file | |||
1116 | } | 1116 | } |
1117 | } | 1117 | } |
1118 | 1118 | ||
1119 | sub get_version { | ||
1120 | local *MF; | ||
1121 | my $v = '?'; | ||
1122 | open MF, 'Makefile.ssl' or return $v; | ||
1123 | while (<MF>) { | ||
1124 | $v = $1, last if /^VERSION=(.*?)\s*$/; | ||
1125 | } | ||
1126 | close MF; | ||
1127 | return $v; | ||
1128 | } | ||
1129 | |||
1119 | sub print_def_file | 1130 | sub print_def_file |
1120 | { | 1131 | { |
1121 | (*OUT,my $name,*nums,my @symbols)=@_; | 1132 | (*OUT,my $name,*nums,my @symbols)=@_; |
1122 | my $n = 1; my @e; my @r; my @v; my $prev=""; | 1133 | my $n = 1; my @e; my @r; my @v; my $prev=""; |
1123 | my $liboptions=""; | 1134 | my $liboptions=""; |
1135 | my $libname = $name; | ||
1136 | my $http_vendor = 'www.openssl.org/'; | ||
1137 | my $version = get_version(); | ||
1138 | my $what = "OpenSSL: implementation of Secure Socket Layer"; | ||
1139 | my $description = "$what $version, $name - http://$http_vendor"; | ||
1124 | 1140 | ||
1125 | if ($W32) | 1141 | if ($W32) |
1126 | { $name.="32"; } | 1142 | { $libname.="32"; } |
1127 | elsif ($W16) | 1143 | elsif ($W16) |
1128 | { $name.="16"; } | 1144 | { $libname.="16"; } |
1129 | elsif ($OS2) | 1145 | elsif ($OS2) |
1130 | { $liboptions = "INITINSTANCE\nDATA NONSHARED"; } | 1146 | { # DLL names should not clash on the whole system. |
1147 | # However, they should not have any particular relationship | ||
1148 | # to the name of the static library. Chose descriptive names | ||
1149 | # (must be at most 8 chars). | ||
1150 | my %translate = (ssl => 'open_ssl', crypto => 'cryptssl'); | ||
1151 | $libname = $translate{$name} || $name; | ||
1152 | $liboptions = <<EOO; | ||
1153 | INITINSTANCE | ||
1154 | DATA MULTIPLE NONSHARED | ||
1155 | EOO | ||
1156 | # Vendor field can't contain colon, drat; so we omit http:// | ||
1157 | $description = "\@#$http_vendor:$version#\@$what; DLL for library $name. Build for EMX -Zmtd"; | ||
1158 | } | ||
1131 | 1159 | ||
1132 | print OUT <<"EOF"; | 1160 | print OUT <<"EOF"; |
1133 | ; | 1161 | ; |
1134 | ; Definition file for the DLL version of the $name library from OpenSSL | 1162 | ; Definition file for the DLL version of the $name library from OpenSSL |
1135 | ; | 1163 | ; |
1136 | 1164 | ||
1137 | LIBRARY $name $liboptions | 1165 | LIBRARY $libname $liboptions |
1138 | 1166 | ||
1139 | DESCRIPTION 'OpenSSL $name - http://www.openssl.org/' | 1167 | DESCRIPTION '$description' |
1140 | 1168 | ||
1141 | EOF | 1169 | EOF |
1142 | 1170 | ||
diff --git a/src/lib/libcrypto/util/pl/OS2-EMX.pl b/src/lib/libcrypto/util/pl/OS2-EMX.pl index d695dda623..ddb3524210 100644 --- a/src/lib/libcrypto/util/pl/OS2-EMX.pl +++ b/src/lib/libcrypto/util/pl/OS2-EMX.pl | |||
@@ -3,10 +3,12 @@ | |||
3 | # OS2-EMX.pl - for EMX GCC on OS/2 | 3 | # OS2-EMX.pl - for EMX GCC on OS/2 |
4 | # | 4 | # |
5 | 5 | ||
6 | $o='\\'; | 6 | $o='/'; |
7 | $cp='copy'; | 7 | $cp='cp'; |
8 | $rm='rm -f'; | 8 | $rm='rm -f'; |
9 | 9 | ||
10 | $preamble = "SHELL=sh\n"; | ||
11 | |||
10 | # C compiler stuff | 12 | # C compiler stuff |
11 | 13 | ||
12 | $cc='gcc'; | 14 | $cc='gcc'; |
@@ -48,24 +50,24 @@ $bf_enc_src=""; | |||
48 | 50 | ||
49 | if (!$no_asm) | 51 | if (!$no_asm) |
50 | { | 52 | { |
51 | $bn_asm_obj="crypto\\bn\\asm\\bn-os2$obj crypto\\bn\\asm\\co-os2$obj"; | 53 | $bn_asm_obj="crypto/bn/asm/bn-os2$obj crypto/bn/asm/co-os2$obj"; |
52 | $bn_asm_src="crypto\\bn\\asm\\bn-os2.asm crypto\\bn\\asm\\co-os2.asm"; | 54 | $bn_asm_src="crypto/bn/asm/bn-os2.asm crypto/bn/asm/co-os2.asm"; |
53 | $des_enc_obj="crypto\\des\\asm\\d-os2$obj crypto\\des\\asm\\y-os2$obj"; | 55 | $des_enc_obj="crypto/des/asm/d-os2$obj crypto/des/asm/y-os2$obj"; |
54 | $des_enc_src="crypto\\des\\asm\\d-os2.asm crypto\\des\\asm\\y-os2.asm"; | 56 | $des_enc_src="crypto/des/asm/d-os2.asm crypto/des/asm/y-os2.asm"; |
55 | $bf_enc_obj="crypto\\bf\\asm\\b-os2$obj"; | 57 | $bf_enc_obj="crypto/bf/asm/b-os2$obj"; |
56 | $bf_enc_src="crypto\\bf\\asm\\b-os2.asm"; | 58 | $bf_enc_src="crypto/bf/asm/b-os2.asm"; |
57 | $cast_enc_obj="crypto\\cast\\asm\\c-os2$obj"; | 59 | $cast_enc_obj="crypto/cast/asm/c-os2$obj"; |
58 | $cast_enc_src="crypto\\cast\\asm\\c-os2.asm"; | 60 | $cast_enc_src="crypto/cast/asm/c-os2.asm"; |
59 | $rc4_enc_obj="crypto\\rc4\\asm\\r4-os2$obj"; | 61 | $rc4_enc_obj="crypto/rc4/asm/r4-os2$obj"; |
60 | $rc4_enc_src="crypto\\rc4\\asm\\r4-os2.asm"; | 62 | $rc4_enc_src="crypto/rc4/asm/r4-os2.asm"; |
61 | $rc5_enc_obj="crypto\\rc5\\asm\\r5-os2$obj"; | 63 | $rc5_enc_obj="crypto/rc5/asm/r5-os2$obj"; |
62 | $rc5_enc_src="crypto\\rc5\\asm\\r5-os2.asm"; | 64 | $rc5_enc_src="crypto/rc5/asm/r5-os2.asm"; |
63 | $md5_asm_obj="crypto\\md5\\asm\\m5-os2$obj"; | 65 | $md5_asm_obj="crypto/md5/asm/m5-os2$obj"; |
64 | $md5_asm_src="crypto\\md5\\asm\\m5-os2.asm"; | 66 | $md5_asm_src="crypto/md5/asm/m5-os2.asm"; |
65 | $sha1_asm_obj="crypto\\sha\\asm\\s1-os2$obj"; | 67 | $sha1_asm_obj="crypto/sha/asm/s1-os2$obj"; |
66 | $sha1_asm_src="crypto\\sha\\asm\\s1-os2.asm"; | 68 | $sha1_asm_src="crypto/sha/asm/s1-os2.asm"; |
67 | $rmd160_asm_obj="crypto\\ripemd\\asm\\rm-os2$obj"; | 69 | $rmd160_asm_obj="crypto/ripemd/asm/rm-os2$obj"; |
68 | $rmd160_asm_src="crypto\\ripemd\\asm\\rm-os2.asm"; | 70 | $rmd160_asm_src="crypto/ripemd/asm/rm-os2.asm"; |
69 | } | 71 | } |
70 | 72 | ||
71 | if ($shlib) | 73 | if ($shlib) |