diff options
Diffstat (limited to 'src/lib/libcrypto')
121 files changed, 958 insertions, 443 deletions
diff --git a/src/lib/libcrypto/Attic/Makefile b/src/lib/libcrypto/Attic/Makefile index 05e3bb701e..6759b2e4d0 100644 --- a/src/lib/libcrypto/Attic/Makefile +++ b/src/lib/libcrypto/Attic/Makefile | |||
@@ -34,8 +34,8 @@ SDIRS= md2 md5 sha mdc2 hmac ripemd \ | |||
34 | GENERAL=Makefile README crypto-lib.com install.com | 34 | GENERAL=Makefile README crypto-lib.com install.com |
35 | 35 | ||
36 | LIB= $(TOP)/libcrypto.a | 36 | LIB= $(TOP)/libcrypto.a |
37 | LIBSRC= cryptlib.c mem.c mem_dbg.c cversion.c ex_data.c tmdiff.c cpt_err.c ebcdic.c | 37 | LIBSRC= cryptlib.c mem.c mem_dbg.c cversion.c ex_data.c tmdiff.c cpt_err.c ebcdic.c uid.c |
38 | LIBOBJ= cryptlib.o mem.o mem_dbg.o cversion.o ex_data.o tmdiff.o cpt_err.o ebcdic.o | 38 | LIBOBJ= cryptlib.o mem.o mem_dbg.o cversion.o ex_data.o tmdiff.o cpt_err.o ebcdic.o uid.o |
39 | 39 | ||
40 | SRC= $(LIBSRC) | 40 | SRC= $(LIBSRC) |
41 | 41 | ||
@@ -90,7 +90,8 @@ links: | |||
90 | 90 | ||
91 | lib: $(LIBOBJ) | 91 | lib: $(LIBOBJ) |
92 | $(AR) $(LIB) $(LIBOBJ) | 92 | $(AR) $(LIB) $(LIBOBJ) |
93 | $(RANLIB) $(LIB) | 93 | @echo You may get an error following this line. Please ignore. |
94 | - $(RANLIB) $(LIB) | ||
94 | @touch lib | 95 | @touch lib |
95 | 96 | ||
96 | libs: | 97 | libs: |
@@ -197,3 +198,6 @@ tmdiff.o: ../include/openssl/lhash.h ../include/openssl/opensslconf.h | |||
197 | tmdiff.o: ../include/openssl/opensslv.h ../include/openssl/safestack.h | 198 | tmdiff.o: ../include/openssl/opensslv.h ../include/openssl/safestack.h |
198 | tmdiff.o: ../include/openssl/stack.h ../include/openssl/symhacks.h | 199 | tmdiff.o: ../include/openssl/stack.h ../include/openssl/symhacks.h |
199 | tmdiff.o: ../include/openssl/tmdiff.h cryptlib.h | 200 | tmdiff.o: ../include/openssl/tmdiff.h cryptlib.h |
201 | uid.o: ../include/openssl/crypto.h ../include/openssl/opensslv.h | ||
202 | uid.o: ../include/openssl/safestack.h ../include/openssl/stack.h | ||
203 | uid.o: ../include/openssl/symhacks.h | ||
diff --git a/src/lib/libcrypto/Makefile.ssl b/src/lib/libcrypto/Makefile.ssl index 05e3bb701e..6759b2e4d0 100644 --- a/src/lib/libcrypto/Makefile.ssl +++ b/src/lib/libcrypto/Makefile.ssl | |||
@@ -34,8 +34,8 @@ SDIRS= md2 md5 sha mdc2 hmac ripemd \ | |||
34 | GENERAL=Makefile README crypto-lib.com install.com | 34 | GENERAL=Makefile README crypto-lib.com install.com |
35 | 35 | ||
36 | LIB= $(TOP)/libcrypto.a | 36 | LIB= $(TOP)/libcrypto.a |
37 | LIBSRC= cryptlib.c mem.c mem_dbg.c cversion.c ex_data.c tmdiff.c cpt_err.c ebcdic.c | 37 | LIBSRC= cryptlib.c mem.c mem_dbg.c cversion.c ex_data.c tmdiff.c cpt_err.c ebcdic.c uid.c |
38 | LIBOBJ= cryptlib.o mem.o mem_dbg.o cversion.o ex_data.o tmdiff.o cpt_err.o ebcdic.o | 38 | LIBOBJ= cryptlib.o mem.o mem_dbg.o cversion.o ex_data.o tmdiff.o cpt_err.o ebcdic.o uid.o |
39 | 39 | ||
40 | SRC= $(LIBSRC) | 40 | SRC= $(LIBSRC) |
41 | 41 | ||
@@ -90,7 +90,8 @@ links: | |||
90 | 90 | ||
91 | lib: $(LIBOBJ) | 91 | lib: $(LIBOBJ) |
92 | $(AR) $(LIB) $(LIBOBJ) | 92 | $(AR) $(LIB) $(LIBOBJ) |
93 | $(RANLIB) $(LIB) | 93 | @echo You may get an error following this line. Please ignore. |
94 | - $(RANLIB) $(LIB) | ||
94 | @touch lib | 95 | @touch lib |
95 | 96 | ||
96 | libs: | 97 | libs: |
@@ -197,3 +198,6 @@ tmdiff.o: ../include/openssl/lhash.h ../include/openssl/opensslconf.h | |||
197 | tmdiff.o: ../include/openssl/opensslv.h ../include/openssl/safestack.h | 198 | tmdiff.o: ../include/openssl/opensslv.h ../include/openssl/safestack.h |
198 | tmdiff.o: ../include/openssl/stack.h ../include/openssl/symhacks.h | 199 | tmdiff.o: ../include/openssl/stack.h ../include/openssl/symhacks.h |
199 | tmdiff.o: ../include/openssl/tmdiff.h cryptlib.h | 200 | tmdiff.o: ../include/openssl/tmdiff.h cryptlib.h |
201 | uid.o: ../include/openssl/crypto.h ../include/openssl/opensslv.h | ||
202 | uid.o: ../include/openssl/safestack.h ../include/openssl/stack.h | ||
203 | uid.o: ../include/openssl/symhacks.h | ||
diff --git a/src/lib/libcrypto/asn1/Makefile.ssl b/src/lib/libcrypto/asn1/Makefile.ssl index b8059ddffe..dace5be2bc 100644 --- a/src/lib/libcrypto/asn1/Makefile.ssl +++ b/src/lib/libcrypto/asn1/Makefile.ssl | |||
@@ -75,7 +75,8 @@ all: lib | |||
75 | 75 | ||
76 | lib: $(LIBOBJ) | 76 | lib: $(LIBOBJ) |
77 | $(AR) $(LIB) $(LIBOBJ) | 77 | $(AR) $(LIB) $(LIBOBJ) |
78 | $(RANLIB) $(LIB) | 78 | @echo You may get an error following this line. Please ignore. |
79 | - $(RANLIB) $(LIB) | ||
79 | @touch lib | 80 | @touch lib |
80 | 81 | ||
81 | files: | 82 | files: |
diff --git a/src/lib/libcrypto/asn1/a_strnid.c b/src/lib/libcrypto/asn1/a_strnid.c index 6b10cff994..732e68fe46 100644 --- a/src/lib/libcrypto/asn1/a_strnid.c +++ b/src/lib/libcrypto/asn1/a_strnid.c | |||
@@ -133,7 +133,7 @@ ASN1_STRING *ASN1_STRING_set_by_NID(ASN1_STRING **out, const unsigned char *in, | |||
133 | if(tbl) { | 133 | if(tbl) { |
134 | mask = tbl->mask; | 134 | mask = tbl->mask; |
135 | if(!(tbl->flags & STABLE_NO_MASK)) mask &= global_mask; | 135 | if(!(tbl->flags & STABLE_NO_MASK)) mask &= global_mask; |
136 | ret = ASN1_mbstring_ncopy(out, in, inlen, inform, tbl->mask, | 136 | ret = ASN1_mbstring_ncopy(out, in, inlen, inform, mask, |
137 | tbl->minsize, tbl->maxsize); | 137 | tbl->minsize, tbl->maxsize); |
138 | } else ret = ASN1_mbstring_copy(out, in, inlen, inform, DIRSTRING_TYPE & global_mask); | 138 | } else ret = ASN1_mbstring_copy(out, in, inlen, inform, DIRSTRING_TYPE & global_mask); |
139 | if(ret <= 0) return NULL; | 139 | if(ret <= 0) return NULL; |
diff --git a/src/lib/libcrypto/asn1/asn1_lib.c b/src/lib/libcrypto/asn1/asn1_lib.c index 77447a5240..a8b651e54e 100644 --- a/src/lib/libcrypto/asn1/asn1_lib.c +++ b/src/lib/libcrypto/asn1/asn1_lib.c | |||
@@ -301,7 +301,7 @@ int asn1_GetSequence(ASN1_CTX *c, long *length) | |||
301 | return(0); | 301 | return(0); |
302 | } | 302 | } |
303 | if (c->inf == (1|V_ASN1_CONSTRUCTED)) | 303 | if (c->inf == (1|V_ASN1_CONSTRUCTED)) |
304 | c->slen= *length+ *(c->pp)-c->p; | 304 | c->slen= *length; |
305 | c->eos=0; | 305 | c->eos=0; |
306 | return(1); | 306 | return(1); |
307 | } | 307 | } |
diff --git a/src/lib/libcrypto/asn1/asn1_mac.h b/src/lib/libcrypto/asn1/asn1_mac.h index 4512ba6cc6..af0e664b2d 100644 --- a/src/lib/libcrypto/asn1/asn1_mac.h +++ b/src/lib/libcrypto/asn1/asn1_mac.h | |||
@@ -196,6 +196,9 @@ err:\ | |||
196 | if ((a != NULL) && (sk_##type##_num(a) != 0)) \ | 196 | if ((a != NULL) && (sk_##type##_num(a) != 0)) \ |
197 | M_ASN1_I2D_put_SEQUENCE_type(type,a,f); | 197 | M_ASN1_I2D_put_SEQUENCE_type(type,a,f); |
198 | 198 | ||
199 | #define M_ASN1_I2D_put_SEQUENCE_opt_ex_type(type,a,f) \ | ||
200 | if (a) M_ASN1_I2D_put_SEQUENCE_type(type,a,f); | ||
201 | |||
199 | #define M_ASN1_D2I_get_IMP_set_opt(b,func,free_func,tag) \ | 202 | #define M_ASN1_D2I_get_IMP_set_opt(b,func,free_func,tag) \ |
200 | if ((c.slen != 0) && \ | 203 | if ((c.slen != 0) && \ |
201 | (M_ASN1_next == \ | 204 | (M_ASN1_next == \ |
@@ -389,6 +392,9 @@ err:\ | |||
389 | if ((a != NULL) && (sk_##type##_num(a) != 0)) \ | 392 | if ((a != NULL) && (sk_##type##_num(a) != 0)) \ |
390 | M_ASN1_I2D_len_SEQUENCE_type(type,a,f); | 393 | M_ASN1_I2D_len_SEQUENCE_type(type,a,f); |
391 | 394 | ||
395 | #define M_ASN1_I2D_len_SEQUENCE_opt_ex_type(type,a,f) \ | ||
396 | if (a) M_ASN1_I2D_len_SEQUENCE_type(type,a,f); | ||
397 | |||
392 | #define M_ASN1_I2D_len_IMP_SET(a,f,x) \ | 398 | #define M_ASN1_I2D_len_IMP_SET(a,f,x) \ |
393 | ret+=i2d_ASN1_SET(a,NULL,f,x,V_ASN1_CONTEXT_SPECIFIC,IS_SET); | 399 | ret+=i2d_ASN1_SET(a,NULL,f,x,V_ASN1_CONTEXT_SPECIFIC,IS_SET); |
394 | 400 | ||
@@ -452,6 +458,15 @@ err:\ | |||
452 | ret+=ASN1_object_size(1,v,mtag); \ | 458 | ret+=ASN1_object_size(1,v,mtag); \ |
453 | } | 459 | } |
454 | 460 | ||
461 | #define M_ASN1_I2D_len_EXP_SEQUENCE_opt_ex_type(type,a,f,mtag,tag,v) \ | ||
462 | if (a)\ | ||
463 | { \ | ||
464 | v=i2d_ASN1_SET_OF_##type(a,NULL,f,tag, \ | ||
465 | V_ASN1_UNIVERSAL, \ | ||
466 | IS_SEQUENCE); \ | ||
467 | ret+=ASN1_object_size(1,v,mtag); \ | ||
468 | } | ||
469 | |||
455 | /* Put Macros */ | 470 | /* Put Macros */ |
456 | #define M_ASN1_I2D_put(a,f) f(a,&p) | 471 | #define M_ASN1_I2D_put(a,f) f(a,&p) |
457 | 472 | ||
@@ -536,6 +551,14 @@ err:\ | |||
536 | IS_SEQUENCE); \ | 551 | IS_SEQUENCE); \ |
537 | } | 552 | } |
538 | 553 | ||
554 | #define M_ASN1_I2D_put_EXP_SEQUENCE_opt_ex_type(type,a,f,mtag,tag,v) \ | ||
555 | if (a) \ | ||
556 | { \ | ||
557 | ASN1_put_object(&p,1,v,mtag,V_ASN1_CONTEXT_SPECIFIC); \ | ||
558 | i2d_ASN1_SET_OF_##type(a,&p,f,tag,V_ASN1_UNIVERSAL, \ | ||
559 | IS_SEQUENCE); \ | ||
560 | } | ||
561 | |||
539 | #define M_ASN1_I2D_seq_total() \ | 562 | #define M_ASN1_I2D_seq_total() \ |
540 | r=ASN1_object_size(1,ret,V_ASN1_SEQUENCE); \ | 563 | r=ASN1_object_size(1,ret,V_ASN1_SEQUENCE); \ |
541 | if (pp == NULL) return(r); \ | 564 | if (pp == NULL) return(r); \ |
diff --git a/src/lib/libcrypto/asn1/p7_lib.c b/src/lib/libcrypto/asn1/p7_lib.c index b1196ef581..8a340b0119 100644 --- a/src/lib/libcrypto/asn1/p7_lib.c +++ b/src/lib/libcrypto/asn1/p7_lib.c | |||
@@ -307,12 +307,14 @@ PKCS7 *d2i_PKCS7(PKCS7 **a, unsigned char **pp, long length) | |||
307 | } | 307 | } |
308 | if (Tinf == (1|V_ASN1_CONSTRUCTED)) | 308 | if (Tinf == (1|V_ASN1_CONSTRUCTED)) |
309 | { | 309 | { |
310 | c.q=c.p; | ||
310 | if (!ASN1_check_infinite_end(&c.p,c.slen)) | 311 | if (!ASN1_check_infinite_end(&c.p,c.slen)) |
311 | { | 312 | { |
312 | c.error=ERR_R_MISSING_ASN1_EOS; | 313 | c.error=ERR_R_MISSING_ASN1_EOS; |
313 | c.line=__LINE__; | 314 | c.line=__LINE__; |
314 | goto err; | 315 | goto err; |
315 | } | 316 | } |
317 | c.slen-=(c.p-c.q); | ||
316 | } | 318 | } |
317 | } | 319 | } |
318 | else | 320 | else |
diff --git a/src/lib/libcrypto/asn1/x_crl.c b/src/lib/libcrypto/asn1/x_crl.c index 1f302d0e01..51518cdf35 100644 --- a/src/lib/libcrypto/asn1/x_crl.c +++ b/src/lib/libcrypto/asn1/x_crl.c | |||
@@ -71,14 +71,14 @@ int i2d_X509_REVOKED(X509_REVOKED *a, unsigned char **pp) | |||
71 | 71 | ||
72 | M_ASN1_I2D_len(a->serialNumber,i2d_ASN1_INTEGER); | 72 | M_ASN1_I2D_len(a->serialNumber,i2d_ASN1_INTEGER); |
73 | M_ASN1_I2D_len(a->revocationDate,i2d_ASN1_TIME); | 73 | M_ASN1_I2D_len(a->revocationDate,i2d_ASN1_TIME); |
74 | M_ASN1_I2D_len_SEQUENCE_opt_type(X509_EXTENSION,a->extensions, | 74 | M_ASN1_I2D_len_SEQUENCE_opt_ex_type(X509_EXTENSION,a->extensions, |
75 | i2d_X509_EXTENSION); | 75 | i2d_X509_EXTENSION); |
76 | 76 | ||
77 | M_ASN1_I2D_seq_total(); | 77 | M_ASN1_I2D_seq_total(); |
78 | 78 | ||
79 | M_ASN1_I2D_put(a->serialNumber,i2d_ASN1_INTEGER); | 79 | M_ASN1_I2D_put(a->serialNumber,i2d_ASN1_INTEGER); |
80 | M_ASN1_I2D_put(a->revocationDate,i2d_ASN1_TIME); | 80 | M_ASN1_I2D_put(a->revocationDate,i2d_ASN1_TIME); |
81 | M_ASN1_I2D_put_SEQUENCE_opt_type(X509_EXTENSION,a->extensions, | 81 | M_ASN1_I2D_put_SEQUENCE_opt_ex_type(X509_EXTENSION,a->extensions, |
82 | i2d_X509_EXTENSION); | 82 | i2d_X509_EXTENSION); |
83 | 83 | ||
84 | M_ASN1_I2D_finish(); | 84 | M_ASN1_I2D_finish(); |
@@ -121,7 +121,7 @@ int i2d_X509_CRL_INFO(X509_CRL_INFO *a, unsigned char **pp) | |||
121 | { M_ASN1_I2D_len(a->nextUpdate,i2d_ASN1_TIME); } | 121 | { M_ASN1_I2D_len(a->nextUpdate,i2d_ASN1_TIME); } |
122 | M_ASN1_I2D_len_SEQUENCE_opt_type(X509_REVOKED,a->revoked, | 122 | M_ASN1_I2D_len_SEQUENCE_opt_type(X509_REVOKED,a->revoked, |
123 | i2d_X509_REVOKED); | 123 | i2d_X509_REVOKED); |
124 | M_ASN1_I2D_len_EXP_SEQUENCE_opt_type(X509_EXTENSION,a->extensions, | 124 | M_ASN1_I2D_len_EXP_SEQUENCE_opt_ex_type(X509_EXTENSION,a->extensions, |
125 | i2d_X509_EXTENSION,0, | 125 | i2d_X509_EXTENSION,0, |
126 | V_ASN1_SEQUENCE,v1); | 126 | V_ASN1_SEQUENCE,v1); |
127 | 127 | ||
@@ -138,7 +138,7 @@ int i2d_X509_CRL_INFO(X509_CRL_INFO *a, unsigned char **pp) | |||
138 | { M_ASN1_I2D_put(a->nextUpdate,i2d_ASN1_TIME); } | 138 | { M_ASN1_I2D_put(a->nextUpdate,i2d_ASN1_TIME); } |
139 | M_ASN1_I2D_put_SEQUENCE_opt_type(X509_REVOKED,a->revoked, | 139 | M_ASN1_I2D_put_SEQUENCE_opt_type(X509_REVOKED,a->revoked, |
140 | i2d_X509_REVOKED); | 140 | i2d_X509_REVOKED); |
141 | M_ASN1_I2D_put_EXP_SEQUENCE_opt_type(X509_EXTENSION,a->extensions, | 141 | M_ASN1_I2D_put_EXP_SEQUENCE_opt_ex_type(X509_EXTENSION,a->extensions, |
142 | i2d_X509_EXTENSION,0, | 142 | i2d_X509_EXTENSION,0, |
143 | V_ASN1_SEQUENCE,v1); | 143 | V_ASN1_SEQUENCE,v1); |
144 | 144 | ||
@@ -260,7 +260,7 @@ X509_CRL_INFO *X509_CRL_INFO_new(void) | |||
260 | M_ASN1_New(ret->lastUpdate,M_ASN1_UTCTIME_new); | 260 | M_ASN1_New(ret->lastUpdate,M_ASN1_UTCTIME_new); |
261 | ret->nextUpdate=NULL; | 261 | ret->nextUpdate=NULL; |
262 | M_ASN1_New(ret->revoked,sk_X509_REVOKED_new_null); | 262 | M_ASN1_New(ret->revoked,sk_X509_REVOKED_new_null); |
263 | M_ASN1_New(ret->extensions,sk_X509_EXTENSION_new_null); | 263 | ret->extensions = NULL; |
264 | sk_X509_REVOKED_set_cmp_func(ret->revoked,X509_REVOKED_cmp); | 264 | sk_X509_REVOKED_set_cmp_func(ret->revoked,X509_REVOKED_cmp); |
265 | return(ret); | 265 | return(ret); |
266 | M_ASN1_New_Error(ASN1_F_X509_CRL_INFO_NEW); | 266 | M_ASN1_New_Error(ASN1_F_X509_CRL_INFO_NEW); |
diff --git a/src/lib/libcrypto/asn1/x_name.c b/src/lib/libcrypto/asn1/x_name.c index b832deb928..1885d699ef 100644 --- a/src/lib/libcrypto/asn1/x_name.c +++ b/src/lib/libcrypto/asn1/x_name.c | |||
@@ -141,10 +141,12 @@ static int i2d_X509_NAME_entries(X509_NAME *a) | |||
141 | } | 141 | } |
142 | size+=i2d_X509_NAME_ENTRY(ne,NULL); | 142 | size+=i2d_X509_NAME_ENTRY(ne,NULL); |
143 | } | 143 | } |
144 | |||
145 | ret+=ASN1_object_size(1,size,V_ASN1_SET); | ||
146 | if (fe != NULL) | 144 | if (fe != NULL) |
145 | { | ||
146 | /* SET OF needed only if entries is non empty */ | ||
147 | ret+=ASN1_object_size(1,size,V_ASN1_SET); | ||
147 | fe->size=size; | 148 | fe->size=size; |
149 | } | ||
148 | 150 | ||
149 | r=ASN1_object_size(1,ret,V_ASN1_SEQUENCE); | 151 | r=ASN1_object_size(1,ret,V_ASN1_SEQUENCE); |
150 | 152 | ||
diff --git a/src/lib/libcrypto/bf/Makefile.ssl b/src/lib/libcrypto/bf/Makefile.ssl index f4eb90f13f..9205ee7901 100644 --- a/src/lib/libcrypto/bf/Makefile.ssl +++ b/src/lib/libcrypto/bf/Makefile.ssl | |||
@@ -44,7 +44,8 @@ all: lib | |||
44 | 44 | ||
45 | lib: $(LIBOBJ) | 45 | lib: $(LIBOBJ) |
46 | $(AR) $(LIB) $(LIBOBJ) | 46 | $(AR) $(LIB) $(LIBOBJ) |
47 | $(RANLIB) $(LIB) | 47 | @echo You may get an error following this line. Please ignore. |
48 | - $(RANLIB) $(LIB) | ||
48 | @touch lib | 49 | @touch lib |
49 | 50 | ||
50 | # elf | 51 | # elf |
diff --git a/src/lib/libcrypto/bio/Makefile.ssl b/src/lib/libcrypto/bio/Makefile.ssl index 916d651d47..567d3fb870 100644 --- a/src/lib/libcrypto/bio/Makefile.ssl +++ b/src/lib/libcrypto/bio/Makefile.ssl | |||
@@ -49,7 +49,8 @@ all: lib | |||
49 | 49 | ||
50 | lib: $(LIBOBJ) | 50 | lib: $(LIBOBJ) |
51 | $(AR) $(LIB) $(LIBOBJ) | 51 | $(AR) $(LIB) $(LIBOBJ) |
52 | $(RANLIB) $(LIB) | 52 | @echo You may get an error following this line. Please ignore. |
53 | - $(RANLIB) $(LIB) | ||
53 | @touch lib | 54 | @touch lib |
54 | 55 | ||
55 | files: | 56 | files: |
@@ -95,13 +96,13 @@ b_dump.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | |||
95 | b_dump.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | 96 | b_dump.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h |
96 | b_dump.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 97 | b_dump.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
97 | b_dump.o: ../cryptlib.h | 98 | b_dump.o: ../cryptlib.h |
98 | b_print.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | 99 | b_print.o: ../../include/openssl/bio.h ../../include/openssl/bn.h |
99 | b_print.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h | 100 | b_print.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
100 | b_print.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | 101 | b_print.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h |
101 | b_print.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | 102 | b_print.o: ../../include/openssl/err.h ../../include/openssl/lhash.h |
102 | b_print.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | 103 | b_print.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h |
103 | b_print.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 104 | b_print.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h |
104 | b_print.o: ../cryptlib.h | 105 | b_print.o: ../../include/openssl/symhacks.h ../cryptlib.h |
105 | b_sock.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | 106 | b_sock.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h |
106 | b_sock.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h | 107 | b_sock.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h |
107 | b_sock.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | 108 | b_sock.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h |
diff --git a/src/lib/libcrypto/bio/b_print.c b/src/lib/libcrypto/bio/b_print.c index a62f551635..b4f7a85f2e 100644 --- a/src/lib/libcrypto/bio/b_print.c +++ b/src/lib/libcrypto/bio/b_print.c | |||
@@ -69,6 +69,7 @@ | |||
69 | #ifndef NO_SYS_TYPES_H | 69 | #ifndef NO_SYS_TYPES_H |
70 | #include <sys/types.h> | 70 | #include <sys/types.h> |
71 | #endif | 71 | #endif |
72 | #include <openssl/bn.h> /* To get BN_LLONG properly defined */ | ||
72 | #include <openssl/bio.h> | 73 | #include <openssl/bio.h> |
73 | 74 | ||
74 | #ifdef BN_LLONG | 75 | #ifdef BN_LLONG |
diff --git a/src/lib/libcrypto/bio/b_sock.c b/src/lib/libcrypto/bio/b_sock.c index 64310058b4..62cc3f1a0c 100644 --- a/src/lib/libcrypto/bio/b_sock.c +++ b/src/lib/libcrypto/bio/b_sock.c | |||
@@ -113,8 +113,8 @@ int BIO_get_host_ip(const char *str, unsigned char *ip) | |||
113 | 113 | ||
114 | /* At this point, we have something that is most probably correct | 114 | /* At this point, we have something that is most probably correct |
115 | in some way, so let's init the socket. */ | 115 | in some way, so let's init the socket. */ |
116 | if (!BIO_sock_init()) | 116 | if (BIO_sock_init() != 1) |
117 | return(0); /* don't generate another error code here */ | 117 | return 0; /* don't generate another error code here */ |
118 | 118 | ||
119 | /* If the string actually contained an IP address, we need not do | 119 | /* If the string actually contained an IP address, we need not do |
120 | anything more */ | 120 | anything more */ |
@@ -519,15 +519,15 @@ int BIO_get_accept_socket(char *host, int bind_mode) | |||
519 | { | 519 | { |
520 | int ret=0; | 520 | int ret=0; |
521 | struct sockaddr_in server,client; | 521 | struct sockaddr_in server,client; |
522 | int s= -1,cs; | 522 | int s=INVALID_SOCKET,cs; |
523 | unsigned char ip[4]; | 523 | unsigned char ip[4]; |
524 | unsigned short port; | 524 | unsigned short port; |
525 | char *str,*e; | 525 | char *str=NULL,*e; |
526 | const char *h,*p; | 526 | const char *h,*p; |
527 | unsigned long l; | 527 | unsigned long l; |
528 | int err_num; | 528 | int err_num; |
529 | 529 | ||
530 | if (!BIO_sock_init()) return(INVALID_SOCKET); | 530 | if (BIO_sock_init() != 1) return(INVALID_SOCKET); |
531 | 531 | ||
532 | if ((str=BUF_strdup(host)) == NULL) return(INVALID_SOCKET); | 532 | if ((str=BUF_strdup(host)) == NULL) return(INVALID_SOCKET); |
533 | 533 | ||
@@ -553,7 +553,7 @@ int BIO_get_accept_socket(char *host, int bind_mode) | |||
553 | h="*"; | 553 | h="*"; |
554 | } | 554 | } |
555 | 555 | ||
556 | if (!BIO_get_port(p,&port)) return(INVALID_SOCKET); | 556 | if (!BIO_get_port(p,&port)) goto err; |
557 | 557 | ||
558 | memset((char *)&server,0,sizeof(server)); | 558 | memset((char *)&server,0,sizeof(server)); |
559 | server.sin_family=AF_INET; | 559 | server.sin_family=AF_INET; |
@@ -563,7 +563,7 @@ int BIO_get_accept_socket(char *host, int bind_mode) | |||
563 | server.sin_addr.s_addr=INADDR_ANY; | 563 | server.sin_addr.s_addr=INADDR_ANY; |
564 | else | 564 | else |
565 | { | 565 | { |
566 | if (!BIO_get_host_ip(h,&(ip[0]))) return(INVALID_SOCKET); | 566 | if (!BIO_get_host_ip(h,&(ip[0]))) goto err; |
567 | l=(unsigned long) | 567 | l=(unsigned long) |
568 | ((unsigned long)ip[0]<<24L)| | 568 | ((unsigned long)ip[0]<<24L)| |
569 | ((unsigned long)ip[1]<<16L)| | 569 | ((unsigned long)ip[1]<<16L)| |
diff --git a/src/lib/libcrypto/bn/Makefile.ssl b/src/lib/libcrypto/bn/Makefile.ssl index 17b72d577f..526d7adb5c 100644 --- a/src/lib/libcrypto/bn/Makefile.ssl +++ b/src/lib/libcrypto/bn/Makefile.ssl | |||
@@ -68,7 +68,8 @@ bnbug: bnbug.c ../../libcrypto.a top | |||
68 | 68 | ||
69 | lib: $(LIBOBJ) | 69 | lib: $(LIBOBJ) |
70 | $(AR) $(LIB) $(LIBOBJ) | 70 | $(AR) $(LIB) $(LIBOBJ) |
71 | $(RANLIB) $(LIB) | 71 | @echo You may get an error following this line. Please ignore. |
72 | - $(RANLIB) $(LIB) | ||
72 | @touch lib | 73 | @touch lib |
73 | 74 | ||
74 | # elf | 75 | # elf |
diff --git a/src/lib/libcrypto/bn/asm/mips3.s b/src/lib/libcrypto/bn/asm/mips3.s index 2df4dcd4b0..45786c00a5 100644 --- a/src/lib/libcrypto/bn/asm/mips3.s +++ b/src/lib/libcrypto/bn/asm/mips3.s | |||
@@ -586,13 +586,13 @@ LEAF(bn_div_3_words) | |||
586 | ld a0,(a3) | 586 | ld a0,(a3) |
587 | move ta2,a1 | 587 | move ta2,a1 |
588 | ld a1,-8(a3) | 588 | ld a1,-8(a3) |
589 | move ta3,ra | 589 | bne a0,a2,.L_bn_div_3_words_proceed |
590 | move v1,zero | ||
591 | li v0,-1 | 590 | li v0,-1 |
592 | beq a0,a2,.L_bn_div_3_words_skip_div | 591 | jr ra |
592 | .L_bn_div_3_words_proceed: | ||
593 | move ta3,ra | ||
593 | bal bn_div_words | 594 | bal bn_div_words |
594 | move ra,ta3 | 595 | move ra,ta3 |
595 | .L_bn_div_3_words_skip_div: | ||
596 | dmultu ta2,v0 | 596 | dmultu ta2,v0 |
597 | ld t2,-16(a3) | 597 | ld t2,-16(a3) |
598 | move ta0,zero | 598 | move ta0,zero |
diff --git a/src/lib/libcrypto/bn/asm/pa-risc2.s b/src/lib/libcrypto/bn/asm/pa-risc2.s index 7239aa2c76..af9730d062 100644 --- a/src/lib/libcrypto/bn/asm/pa-risc2.s +++ b/src/lib/libcrypto/bn/asm/pa-risc2.s | |||
@@ -1611,7 +1611,7 @@ bn_mul_comba4 | |||
1611 | .IMPORT $global$,DATA | 1611 | .IMPORT $global$,DATA |
1612 | .SPACE $TEXT$ | 1612 | .SPACE $TEXT$ |
1613 | .SUBSPA $CODE$ | 1613 | .SUBSPA $CODE$ |
1614 | .SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=0x2c,SORT=16 | 1614 | .SUBSPA $LIT$,ACCESS=0x2c |
1615 | C$7 | 1615 | C$7 |
1616 | .ALIGN 8 | 1616 | .ALIGN 8 |
1617 | .STRINGZ "Division would overflow (%d)\n" | 1617 | .STRINGZ "Division would overflow (%d)\n" |
diff --git a/src/lib/libcrypto/bn/asm/pa-risc2W.s b/src/lib/libcrypto/bn/asm/pa-risc2W.s index 54b6606252..a99545754d 100644 --- a/src/lib/libcrypto/bn/asm/pa-risc2W.s +++ b/src/lib/libcrypto/bn/asm/pa-risc2W.s | |||
@@ -1598,7 +1598,7 @@ bn_mul_comba4 | |||
1598 | .IMPORT $global$,DATA | 1598 | .IMPORT $global$,DATA |
1599 | .SPACE $TEXT$ | 1599 | .SPACE $TEXT$ |
1600 | .SUBSPA $CODE$ | 1600 | .SUBSPA $CODE$ |
1601 | .SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=0x2c,SORT=16 | 1601 | .SUBSPA $LIT$,ACCESS=0x2c |
1602 | C$4 | 1602 | C$4 |
1603 | .ALIGN 8 | 1603 | .ALIGN 8 |
1604 | .STRINGZ "Division would overflow (%d)\n" | 1604 | .STRINGZ "Division would overflow (%d)\n" |
diff --git a/src/lib/libcrypto/bn/bn.h b/src/lib/libcrypto/bn/bn.h index 1eb8395b25..b232c2ceae 100644 --- a/src/lib/libcrypto/bn/bn.h +++ b/src/lib/libcrypto/bn/bn.h | |||
@@ -239,7 +239,7 @@ typedef struct bignum_st | |||
239 | } BIGNUM; | 239 | } BIGNUM; |
240 | 240 | ||
241 | /* Used for temp variables */ | 241 | /* Used for temp variables */ |
242 | #define BN_CTX_NUM 12 | 242 | #define BN_CTX_NUM 16 |
243 | #define BN_CTX_NUM_POS 12 | 243 | #define BN_CTX_NUM_POS 12 |
244 | typedef struct bignum_ctx | 244 | typedef struct bignum_ctx |
245 | { | 245 | { |
@@ -328,6 +328,7 @@ BIGNUM *BN_CTX_get(BN_CTX *ctx); | |||
328 | void BN_CTX_end(BN_CTX *ctx); | 328 | void BN_CTX_end(BN_CTX *ctx); |
329 | int BN_rand(BIGNUM *rnd, int bits, int top,int bottom); | 329 | int BN_rand(BIGNUM *rnd, int bits, int top,int bottom); |
330 | int BN_pseudo_rand(BIGNUM *rnd, int bits, int top,int bottom); | 330 | int BN_pseudo_rand(BIGNUM *rnd, int bits, int top,int bottom); |
331 | int BN_rand_range(BIGNUM *rnd, BIGNUM *range); | ||
331 | int BN_num_bits(const BIGNUM *a); | 332 | int BN_num_bits(const BIGNUM *a); |
332 | int BN_num_bits_word(BN_ULONG); | 333 | int BN_num_bits_word(BN_ULONG); |
333 | BIGNUM *BN_new(void); | 334 | BIGNUM *BN_new(void); |
@@ -467,6 +468,8 @@ BN_ULONG bn_sub_words(BN_ULONG *rp, BN_ULONG *ap, BN_ULONG *bp,int num); | |||
467 | # define bn_dump(a,b) | 468 | # define bn_dump(a,b) |
468 | #endif | 469 | #endif |
469 | 470 | ||
471 | int BN_bntest_rand(BIGNUM *rnd, int bits, int top,int bottom); | ||
472 | |||
470 | /* BEGIN ERROR CODES */ | 473 | /* BEGIN ERROR CODES */ |
471 | /* The following lines are auto generated by the script mkerr.pl. Any changes | 474 | /* The following lines are auto generated by the script mkerr.pl. Any changes |
472 | * made after this point may be overwritten when the script is next run. | 475 | * made after this point may be overwritten when the script is next run. |
@@ -493,16 +496,19 @@ BN_ULONG bn_sub_words(BN_ULONG *rp, BN_ULONG *ap, BN_ULONG *bp,int num); | |||
493 | #define BN_F_BN_MPI2BN 112 | 496 | #define BN_F_BN_MPI2BN 112 |
494 | #define BN_F_BN_NEW 113 | 497 | #define BN_F_BN_NEW 113 |
495 | #define BN_F_BN_RAND 114 | 498 | #define BN_F_BN_RAND 114 |
499 | #define BN_F_BN_RAND_RANGE 122 | ||
496 | #define BN_F_BN_USUB 115 | 500 | #define BN_F_BN_USUB 115 |
497 | 501 | ||
498 | /* Reason codes. */ | 502 | /* Reason codes. */ |
499 | #define BN_R_ARG2_LT_ARG3 100 | 503 | #define BN_R_ARG2_LT_ARG3 100 |
500 | #define BN_R_BAD_RECIPROCAL 101 | 504 | #define BN_R_BAD_RECIPROCAL 101 |
505 | #define BN_R_BIGNUM_TOO_LONG 114 | ||
501 | #define BN_R_CALLED_WITH_EVEN_MODULUS 102 | 506 | #define BN_R_CALLED_WITH_EVEN_MODULUS 102 |
502 | #define BN_R_DIV_BY_ZERO 103 | 507 | #define BN_R_DIV_BY_ZERO 103 |
503 | #define BN_R_ENCODING_ERROR 104 | 508 | #define BN_R_ENCODING_ERROR 104 |
504 | #define BN_R_EXPAND_ON_STATIC_BIGNUM_DATA 105 | 509 | #define BN_R_EXPAND_ON_STATIC_BIGNUM_DATA 105 |
505 | #define BN_R_INVALID_LENGTH 106 | 510 | #define BN_R_INVALID_LENGTH 106 |
511 | #define BN_R_INVALID_RANGE 115 | ||
506 | #define BN_R_NOT_INITIALIZED 107 | 512 | #define BN_R_NOT_INITIALIZED 107 |
507 | #define BN_R_NO_INVERSE 108 | 513 | #define BN_R_NO_INVERSE 108 |
508 | #define BN_R_TOO_MANY_TEMPORARY_VARIABLES 109 | 514 | #define BN_R_TOO_MANY_TEMPORARY_VARIABLES 109 |
diff --git a/src/lib/libcrypto/bn/bn_div.c b/src/lib/libcrypto/bn/bn_div.c index c3772c243b..c328b5b411 100644 --- a/src/lib/libcrypto/bn/bn_div.c +++ b/src/lib/libcrypto/bn/bn_div.c | |||
@@ -180,13 +180,13 @@ int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, | |||
180 | 180 | ||
181 | BN_CTX_start(ctx); | 181 | BN_CTX_start(ctx); |
182 | tmp=BN_CTX_get(ctx); | 182 | tmp=BN_CTX_get(ctx); |
183 | tmp->neg=0; | ||
184 | snum=BN_CTX_get(ctx); | 183 | snum=BN_CTX_get(ctx); |
185 | sdiv=BN_CTX_get(ctx); | 184 | sdiv=BN_CTX_get(ctx); |
186 | if (dv == NULL) | 185 | if (dv == NULL) |
187 | res=BN_CTX_get(ctx); | 186 | res=BN_CTX_get(ctx); |
188 | else res=dv; | 187 | else res=dv; |
189 | if (res == NULL) goto err; | 188 | if (sdiv==NULL || res == NULL) goto err; |
189 | tmp->neg=0; | ||
190 | 190 | ||
191 | /* First we normalise the numbers */ | 191 | /* First we normalise the numbers */ |
192 | norm_shift=BN_BITS2-((BN_num_bits(divisor))%BN_BITS2); | 192 | norm_shift=BN_BITS2-((BN_num_bits(divisor))%BN_BITS2); |
@@ -237,7 +237,8 @@ int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, | |||
237 | for (i=0; i<loop-1; i++) | 237 | for (i=0; i<loop-1; i++) |
238 | { | 238 | { |
239 | BN_ULONG q,l0; | 239 | BN_ULONG q,l0; |
240 | #ifdef BN_DIV3W | 240 | #if defined(BN_DIV3W) && !defined(NO_ASM) |
241 | BN_ULONG bn_div_3_words(BN_ULONG*,BN_ULONG,BN_ULONG); | ||
241 | q=bn_div_3_words(wnump,d1,d0); | 242 | q=bn_div_3_words(wnump,d1,d0); |
242 | #else | 243 | #else |
243 | BN_ULONG n0,n1,rem=0; | 244 | BN_ULONG n0,n1,rem=0; |
diff --git a/src/lib/libcrypto/bn/bn_err.c b/src/lib/libcrypto/bn/bn_err.c index 86550c4c21..adc6a214fc 100644 --- a/src/lib/libcrypto/bn/bn_err.c +++ b/src/lib/libcrypto/bn/bn_err.c | |||
@@ -84,6 +84,7 @@ static ERR_STRING_DATA BN_str_functs[]= | |||
84 | {ERR_PACK(0,BN_F_BN_MPI2BN,0), "BN_mpi2bn"}, | 84 | {ERR_PACK(0,BN_F_BN_MPI2BN,0), "BN_mpi2bn"}, |
85 | {ERR_PACK(0,BN_F_BN_NEW,0), "BN_new"}, | 85 | {ERR_PACK(0,BN_F_BN_NEW,0), "BN_new"}, |
86 | {ERR_PACK(0,BN_F_BN_RAND,0), "BN_rand"}, | 86 | {ERR_PACK(0,BN_F_BN_RAND,0), "BN_rand"}, |
87 | {ERR_PACK(0,BN_F_BN_RAND_RANGE,0), "BN_rand_range"}, | ||
87 | {ERR_PACK(0,BN_F_BN_USUB,0), "BN_usub"}, | 88 | {ERR_PACK(0,BN_F_BN_USUB,0), "BN_usub"}, |
88 | {0,NULL} | 89 | {0,NULL} |
89 | }; | 90 | }; |
@@ -92,11 +93,13 @@ static ERR_STRING_DATA BN_str_reasons[]= | |||
92 | { | 93 | { |
93 | {BN_R_ARG2_LT_ARG3 ,"arg2 lt arg3"}, | 94 | {BN_R_ARG2_LT_ARG3 ,"arg2 lt arg3"}, |
94 | {BN_R_BAD_RECIPROCAL ,"bad reciprocal"}, | 95 | {BN_R_BAD_RECIPROCAL ,"bad reciprocal"}, |
96 | {BN_R_BIGNUM_TOO_LONG ,"bignum too long"}, | ||
95 | {BN_R_CALLED_WITH_EVEN_MODULUS ,"called with even modulus"}, | 97 | {BN_R_CALLED_WITH_EVEN_MODULUS ,"called with even modulus"}, |
96 | {BN_R_DIV_BY_ZERO ,"div by zero"}, | 98 | {BN_R_DIV_BY_ZERO ,"div by zero"}, |
97 | {BN_R_ENCODING_ERROR ,"encoding error"}, | 99 | {BN_R_ENCODING_ERROR ,"encoding error"}, |
98 | {BN_R_EXPAND_ON_STATIC_BIGNUM_DATA ,"expand on static bignum data"}, | 100 | {BN_R_EXPAND_ON_STATIC_BIGNUM_DATA ,"expand on static bignum data"}, |
99 | {BN_R_INVALID_LENGTH ,"invalid length"}, | 101 | {BN_R_INVALID_LENGTH ,"invalid length"}, |
102 | {BN_R_INVALID_RANGE ,"invalid range"}, | ||
100 | {BN_R_NOT_INITIALIZED ,"not initialized"}, | 103 | {BN_R_NOT_INITIALIZED ,"not initialized"}, |
101 | {BN_R_NO_INVERSE ,"no inverse"}, | 104 | {BN_R_NO_INVERSE ,"no inverse"}, |
102 | {BN_R_TOO_MANY_TEMPORARY_VARIABLES ,"too many temporary variables"}, | 105 | {BN_R_TOO_MANY_TEMPORARY_VARIABLES ,"too many temporary variables"}, |
diff --git a/src/lib/libcrypto/bn/bn_lib.c b/src/lib/libcrypto/bn/bn_lib.c index b6b0ce4b3c..7767d65170 100644 --- a/src/lib/libcrypto/bn/bn_lib.c +++ b/src/lib/libcrypto/bn/bn_lib.c | |||
@@ -62,6 +62,7 @@ | |||
62 | #endif | 62 | #endif |
63 | 63 | ||
64 | #include <assert.h> | 64 | #include <assert.h> |
65 | #include <limits.h> | ||
65 | #include <stdio.h> | 66 | #include <stdio.h> |
66 | #include "cryptlib.h" | 67 | #include "cryptlib.h" |
67 | #include "bn_lcl.h" | 68 | #include "bn_lcl.h" |
@@ -319,6 +320,12 @@ BIGNUM *bn_expand2(BIGNUM *b, int words) | |||
319 | 320 | ||
320 | if (words > b->dmax) | 321 | if (words > b->dmax) |
321 | { | 322 | { |
323 | if (words > (INT_MAX/(4*BN_BITS2))) | ||
324 | { | ||
325 | BNerr(BN_F_BN_EXPAND2,BN_R_BIGNUM_TOO_LONG); | ||
326 | return NULL; | ||
327 | } | ||
328 | |||
322 | bn_check_top(b); | 329 | bn_check_top(b); |
323 | if (BN_get_flags(b,BN_FLG_STATIC_DATA)) | 330 | if (BN_get_flags(b,BN_FLG_STATIC_DATA)) |
324 | { | 331 | { |
diff --git a/src/lib/libcrypto/bn/bn_rand.c b/src/lib/libcrypto/bn/bn_rand.c index 21ecbc04ed..acd0619921 100644 --- a/src/lib/libcrypto/bn/bn_rand.c +++ b/src/lib/libcrypto/bn/bn_rand.c | |||
@@ -76,7 +76,7 @@ static int bnrand(int pseudorand, BIGNUM *rnd, int bits, int top, int bottom) | |||
76 | 76 | ||
77 | bytes=(bits+7)/8; | 77 | bytes=(bits+7)/8; |
78 | bit=(bits-1)%8; | 78 | bit=(bits-1)%8; |
79 | mask=0xff<<bit; | 79 | mask=0xff<<(bit+1); |
80 | 80 | ||
81 | buf=(unsigned char *)OPENSSL_malloc(bytes); | 81 | buf=(unsigned char *)OPENSSL_malloc(bytes); |
82 | if (buf == NULL) | 82 | if (buf == NULL) |
@@ -100,25 +100,48 @@ static int bnrand(int pseudorand, BIGNUM *rnd, int bits, int top, int bottom) | |||
100 | goto err; | 100 | goto err; |
101 | } | 101 | } |
102 | 102 | ||
103 | if (top) | 103 | #if 1 |
104 | if (pseudorand == 2) | ||
104 | { | 105 | { |
105 | if (bit == 0) | 106 | /* generate patterns that are more likely to trigger BN |
107 | library bugs */ | ||
108 | int i; | ||
109 | unsigned char c; | ||
110 | |||
111 | for (i = 0; i < bytes; i++) | ||
112 | { | ||
113 | RAND_pseudo_bytes(&c, 1); | ||
114 | if (c >= 128 && i > 0) | ||
115 | buf[i] = buf[i-1]; | ||
116 | else if (c < 42) | ||
117 | buf[i] = 0; | ||
118 | else if (c < 84) | ||
119 | buf[i] = 255; | ||
120 | } | ||
121 | } | ||
122 | #endif | ||
123 | |||
124 | if (top != -1) | ||
125 | { | ||
126 | if (top) | ||
106 | { | 127 | { |
107 | buf[0]=1; | 128 | if (bit == 0) |
108 | buf[1]|=0x80; | 129 | { |
130 | buf[0]=1; | ||
131 | buf[1]|=0x80; | ||
132 | } | ||
133 | else | ||
134 | { | ||
135 | buf[0]|=(3<<(bit-1)); | ||
136 | } | ||
109 | } | 137 | } |
110 | else | 138 | else |
111 | { | 139 | { |
112 | buf[0]|=(3<<(bit-1)); | 140 | buf[0]|=(1<<bit); |
113 | buf[0]&= ~(mask<<1); | ||
114 | } | 141 | } |
115 | } | 142 | } |
116 | else | 143 | buf[0] &= ~mask; |
117 | { | 144 | if (bottom) /* set bottom bit if requested */ |
118 | buf[0]|=(1<<bit); | ||
119 | buf[0]&= ~(mask<<1); | ||
120 | } | ||
121 | if (bottom) /* set bottom bits to whatever odd is */ | ||
122 | buf[bytes-1]|=1; | 145 | buf[bytes-1]|=1; |
123 | if (!BN_bin2bn(buf,bytes,rnd)) goto err; | 146 | if (!BN_bin2bn(buf,bytes,rnd)) goto err; |
124 | ret=1; | 147 | ret=1; |
@@ -140,3 +163,61 @@ int BN_pseudo_rand(BIGNUM *rnd, int bits, int top, int bottom) | |||
140 | { | 163 | { |
141 | return bnrand(1, rnd, bits, top, bottom); | 164 | return bnrand(1, rnd, bits, top, bottom); |
142 | } | 165 | } |
166 | |||
167 | #if 1 | ||
168 | int BN_bntest_rand(BIGNUM *rnd, int bits, int top, int bottom) | ||
169 | { | ||
170 | return bnrand(2, rnd, bits, top, bottom); | ||
171 | } | ||
172 | #endif | ||
173 | |||
174 | /* random number r: 0 <= r < range */ | ||
175 | int BN_rand_range(BIGNUM *r, BIGNUM *range) | ||
176 | { | ||
177 | int n; | ||
178 | |||
179 | if (range->neg || BN_is_zero(range)) | ||
180 | { | ||
181 | BNerr(BN_F_BN_RAND_RANGE, BN_R_INVALID_RANGE); | ||
182 | return 0; | ||
183 | } | ||
184 | |||
185 | n = BN_num_bits(range); /* n > 0 */ | ||
186 | |||
187 | if (n == 1) | ||
188 | { | ||
189 | if (!BN_zero(r)) return 0; | ||
190 | } | ||
191 | else if (BN_is_bit_set(range, n - 2)) | ||
192 | { | ||
193 | do | ||
194 | { | ||
195 | /* range = 11..._2, so each iteration succeeds with probability >= .75 */ | ||
196 | if (!BN_rand(r, n, -1, 0)) return 0; | ||
197 | } | ||
198 | while (BN_cmp(r, range) >= 0); | ||
199 | } | ||
200 | else | ||
201 | { | ||
202 | /* range = 10..._2, | ||
203 | * so 3*range (= 11..._2) is exactly one bit longer than range */ | ||
204 | do | ||
205 | { | ||
206 | if (!BN_rand(r, n + 1, -1, 0)) return 0; | ||
207 | /* If r < 3*range, use r := r MOD range | ||
208 | * (which is either r, r - range, or r - 2*range). | ||
209 | * Otherwise, iterate once more. | ||
210 | * Since 3*range = 11..._2, each iteration succeeds with | ||
211 | * probability >= .75. */ | ||
212 | if (BN_cmp(r ,range) >= 0) | ||
213 | { | ||
214 | if (!BN_sub(r, r, range)) return 0; | ||
215 | if (BN_cmp(r, range) >= 0) | ||
216 | if (!BN_sub(r, r, range)) return 0; | ||
217 | } | ||
218 | } | ||
219 | while (BN_cmp(r, range) >= 0); | ||
220 | } | ||
221 | |||
222 | return 1; | ||
223 | } | ||
diff --git a/src/lib/libcrypto/bn/bn_shift.c b/src/lib/libcrypto/bn/bn_shift.c index 0883247384..c2608f9f4a 100644 --- a/src/lib/libcrypto/bn/bn_shift.c +++ b/src/lib/libcrypto/bn/bn_shift.c | |||
@@ -172,6 +172,11 @@ int BN_rshift(BIGNUM *r, BIGNUM *a, int n) | |||
172 | r->neg=a->neg; | 172 | r->neg=a->neg; |
173 | if (bn_wexpand(r,a->top-nw+1) == NULL) return(0); | 173 | if (bn_wexpand(r,a->top-nw+1) == NULL) return(0); |
174 | } | 174 | } |
175 | else | ||
176 | { | ||
177 | if (n == 0) | ||
178 | return 1; /* or the copying loop will go berserk */ | ||
179 | } | ||
175 | 180 | ||
176 | f= &(a->d[nw]); | 181 | f= &(a->d[nw]); |
177 | t=r->d; | 182 | t=r->d; |
diff --git a/src/lib/libcrypto/bn/bntest.c b/src/lib/libcrypto/bn/bntest.c index 0a97af69c5..af0c2629e8 100644 --- a/src/lib/libcrypto/bn/bntest.c +++ b/src/lib/libcrypto/bn/bntest.c | |||
@@ -107,11 +107,9 @@ static const char rnd_seed[] = "string to make the random number generator think | |||
107 | static void message(BIO *out, char *m) | 107 | static void message(BIO *out, char *m) |
108 | { | 108 | { |
109 | fprintf(stderr, "test %s\n", m); | 109 | fprintf(stderr, "test %s\n", m); |
110 | #if defined(linux) || defined(__FreeBSD__) /* can we use GNU bc features? */ | ||
111 | BIO_puts(out, "print \"test "); | 110 | BIO_puts(out, "print \"test "); |
112 | BIO_puts(out, m); | 111 | BIO_puts(out, m); |
113 | BIO_puts(out, "\\n\"\n"); | 112 | BIO_puts(out, "\\n\"\n"); |
114 | #endif | ||
115 | } | 113 | } |
116 | 114 | ||
117 | int main(int argc, char *argv[]) | 115 | int main(int argc, char *argv[]) |
@@ -122,9 +120,7 @@ int main(int argc, char *argv[]) | |||
122 | 120 | ||
123 | results = 0; | 121 | results = 0; |
124 | 122 | ||
125 | RAND_seed(rnd_seed, sizeof rnd_seed); /* or BN_rand may fail, and we don't | 123 | RAND_seed(rnd_seed, sizeof rnd_seed); /* or BN_generate_prime may fail */ |
126 | * even check its return value | ||
127 | * (which we should) */ | ||
128 | 124 | ||
129 | argc--; | 125 | argc--; |
130 | argv++; | 126 | argv++; |
@@ -253,10 +249,10 @@ int test_add(BIO *bp) | |||
253 | BN_init(&b); | 249 | BN_init(&b); |
254 | BN_init(&c); | 250 | BN_init(&c); |
255 | 251 | ||
256 | BN_rand(&a,512,0,0); | 252 | BN_bntest_rand(&a,512,0,0); |
257 | for (i=0; i<num0; i++) | 253 | for (i=0; i<num0; i++) |
258 | { | 254 | { |
259 | BN_rand(&b,450+i,0,0); | 255 | BN_bntest_rand(&b,450+i,0,0); |
260 | a.neg=rand_neg(); | 256 | a.neg=rand_neg(); |
261 | b.neg=rand_neg(); | 257 | b.neg=rand_neg(); |
262 | if (bp == NULL) | 258 | if (bp == NULL) |
@@ -305,14 +301,14 @@ int test_sub(BIO *bp) | |||
305 | { | 301 | { |
306 | if (i < num1) | 302 | if (i < num1) |
307 | { | 303 | { |
308 | BN_rand(&a,512,0,0); | 304 | BN_bntest_rand(&a,512,0,0); |
309 | BN_copy(&b,&a); | 305 | BN_copy(&b,&a); |
310 | if (BN_set_bit(&a,i)==0) return(0); | 306 | if (BN_set_bit(&a,i)==0) return(0); |
311 | BN_add_word(&b,i); | 307 | BN_add_word(&b,i); |
312 | } | 308 | } |
313 | else | 309 | else |
314 | { | 310 | { |
315 | BN_rand(&b,400+i-num1,0,0); | 311 | BN_bntest_rand(&b,400+i-num1,0,0); |
316 | a.neg=rand_neg(); | 312 | a.neg=rand_neg(); |
317 | b.neg=rand_neg(); | 313 | b.neg=rand_neg(); |
318 | } | 314 | } |
@@ -362,13 +358,13 @@ int test_div(BIO *bp, BN_CTX *ctx) | |||
362 | { | 358 | { |
363 | if (i < num1) | 359 | if (i < num1) |
364 | { | 360 | { |
365 | BN_rand(&a,400,0,0); | 361 | BN_bntest_rand(&a,400,0,0); |
366 | BN_copy(&b,&a); | 362 | BN_copy(&b,&a); |
367 | BN_lshift(&a,&a,i); | 363 | BN_lshift(&a,&a,i); |
368 | BN_add_word(&a,i); | 364 | BN_add_word(&a,i); |
369 | } | 365 | } |
370 | else | 366 | else |
371 | BN_rand(&b,50+3*(i-num1),0,0); | 367 | BN_bntest_rand(&b,50+3*(i-num1),0,0); |
372 | a.neg=rand_neg(); | 368 | a.neg=rand_neg(); |
373 | b.neg=rand_neg(); | 369 | b.neg=rand_neg(); |
374 | if (bp == NULL) | 370 | if (bp == NULL) |
@@ -432,13 +428,13 @@ int test_div_recp(BIO *bp, BN_CTX *ctx) | |||
432 | { | 428 | { |
433 | if (i < num1) | 429 | if (i < num1) |
434 | { | 430 | { |
435 | BN_rand(&a,400,0,0); | 431 | BN_bntest_rand(&a,400,0,0); |
436 | BN_copy(&b,&a); | 432 | BN_copy(&b,&a); |
437 | BN_lshift(&a,&a,i); | 433 | BN_lshift(&a,&a,i); |
438 | BN_add_word(&a,i); | 434 | BN_add_word(&a,i); |
439 | } | 435 | } |
440 | else | 436 | else |
441 | BN_rand(&b,50+3*(i-num1),0,0); | 437 | BN_bntest_rand(&b,50+3*(i-num1),0,0); |
442 | a.neg=rand_neg(); | 438 | a.neg=rand_neg(); |
443 | b.neg=rand_neg(); | 439 | b.neg=rand_neg(); |
444 | BN_RECP_CTX_set(&recp,&b,ctx); | 440 | BN_RECP_CTX_set(&recp,&b,ctx); |
@@ -509,11 +505,11 @@ int test_mul(BIO *bp) | |||
509 | { | 505 | { |
510 | if (i <= num1) | 506 | if (i <= num1) |
511 | { | 507 | { |
512 | BN_rand(&a,100,0,0); | 508 | BN_bntest_rand(&a,100,0,0); |
513 | BN_rand(&b,100,0,0); | 509 | BN_bntest_rand(&b,100,0,0); |
514 | } | 510 | } |
515 | else | 511 | else |
516 | BN_rand(&b,i-num1,0,0); | 512 | BN_bntest_rand(&b,i-num1,0,0); |
517 | a.neg=rand_neg(); | 513 | a.neg=rand_neg(); |
518 | b.neg=rand_neg(); | 514 | b.neg=rand_neg(); |
519 | if (bp == NULL) | 515 | if (bp == NULL) |
@@ -562,7 +558,7 @@ int test_sqr(BIO *bp, BN_CTX *ctx) | |||
562 | 558 | ||
563 | for (i=0; i<num0; i++) | 559 | for (i=0; i<num0; i++) |
564 | { | 560 | { |
565 | BN_rand(&a,40+i*10,0,0); | 561 | BN_bntest_rand(&a,40+i*10,0,0); |
566 | a.neg=rand_neg(); | 562 | a.neg=rand_neg(); |
567 | if (bp == NULL) | 563 | if (bp == NULL) |
568 | for (j=0; j<100; j++) | 564 | for (j=0; j<100; j++) |
@@ -613,15 +609,15 @@ int test_mont(BIO *bp, BN_CTX *ctx) | |||
613 | 609 | ||
614 | mont=BN_MONT_CTX_new(); | 610 | mont=BN_MONT_CTX_new(); |
615 | 611 | ||
616 | BN_rand(&a,100,0,0); /**/ | 612 | BN_bntest_rand(&a,100,0,0); /**/ |
617 | BN_rand(&b,100,0,0); /**/ | 613 | BN_bntest_rand(&b,100,0,0); /**/ |
618 | for (i=0; i<num2; i++) | 614 | for (i=0; i<num2; i++) |
619 | { | 615 | { |
620 | int bits = (200*(i+1))/num2; | 616 | int bits = (200*(i+1))/num2; |
621 | 617 | ||
622 | if (bits == 0) | 618 | if (bits == 0) |
623 | continue; | 619 | continue; |
624 | BN_rand(&n,bits,0,1); | 620 | BN_bntest_rand(&n,bits,0,1); |
625 | BN_MONT_CTX_set(mont,&n,ctx); | 621 | BN_MONT_CTX_set(mont,&n,ctx); |
626 | 622 | ||
627 | BN_to_montgomery(&A,&a,mont,ctx); | 623 | BN_to_montgomery(&A,&a,mont,ctx); |
@@ -683,10 +679,10 @@ int test_mod(BIO *bp, BN_CTX *ctx) | |||
683 | d=BN_new(); | 679 | d=BN_new(); |
684 | e=BN_new(); | 680 | e=BN_new(); |
685 | 681 | ||
686 | BN_rand(a,1024,0,0); /**/ | 682 | BN_bntest_rand(a,1024,0,0); /**/ |
687 | for (i=0; i<num0; i++) | 683 | for (i=0; i<num0; i++) |
688 | { | 684 | { |
689 | BN_rand(b,450+i*10,0,0); /**/ | 685 | BN_bntest_rand(b,450+i*10,0,0); /**/ |
690 | a->neg=rand_neg(); | 686 | a->neg=rand_neg(); |
691 | b->neg=rand_neg(); | 687 | b->neg=rand_neg(); |
692 | if (bp == NULL) | 688 | if (bp == NULL) |
@@ -732,11 +728,11 @@ int test_mod_mul(BIO *bp, BN_CTX *ctx) | |||
732 | d=BN_new(); | 728 | d=BN_new(); |
733 | e=BN_new(); | 729 | e=BN_new(); |
734 | 730 | ||
735 | BN_rand(c,1024,0,0); /**/ | 731 | BN_bntest_rand(c,1024,0,0); /**/ |
736 | for (i=0; i<num0; i++) | 732 | for (i=0; i<num0; i++) |
737 | { | 733 | { |
738 | BN_rand(a,475+i*10,0,0); /**/ | 734 | BN_bntest_rand(a,475+i*10,0,0); /**/ |
739 | BN_rand(b,425+i*11,0,0); /**/ | 735 | BN_bntest_rand(b,425+i*11,0,0); /**/ |
740 | a->neg=rand_neg(); | 736 | a->neg=rand_neg(); |
741 | b->neg=rand_neg(); | 737 | b->neg=rand_neg(); |
742 | /* if (bp == NULL) | 738 | /* if (bp == NULL) |
@@ -794,11 +790,11 @@ int test_mod_exp(BIO *bp, BN_CTX *ctx) | |||
794 | d=BN_new(); | 790 | d=BN_new(); |
795 | e=BN_new(); | 791 | e=BN_new(); |
796 | 792 | ||
797 | BN_rand(c,30,0,1); /* must be odd for montgomery */ | 793 | BN_bntest_rand(c,30,0,1); /* must be odd for montgomery */ |
798 | for (i=0; i<num2; i++) | 794 | for (i=0; i<num2; i++) |
799 | { | 795 | { |
800 | BN_rand(a,20+i*5,0,0); /**/ | 796 | BN_bntest_rand(a,20+i*5,0,0); /**/ |
801 | BN_rand(b,2+i,0,0); /**/ | 797 | BN_bntest_rand(b,2+i,0,0); /**/ |
802 | 798 | ||
803 | if (!BN_mod_exp(d,a,b,c,ctx)) | 799 | if (!BN_mod_exp(d,a,b,c,ctx)) |
804 | return(00); | 800 | return(00); |
@@ -848,8 +844,8 @@ int test_exp(BIO *bp, BN_CTX *ctx) | |||
848 | 844 | ||
849 | for (i=0; i<num2; i++) | 845 | for (i=0; i<num2; i++) |
850 | { | 846 | { |
851 | BN_rand(a,20+i*5,0,0); /**/ | 847 | BN_bntest_rand(a,20+i*5,0,0); /**/ |
852 | BN_rand(b,2+i,0,0); /**/ | 848 | BN_bntest_rand(b,2+i,0,0); /**/ |
853 | 849 | ||
854 | if (!BN_exp(d,a,b,ctx)) | 850 | if (!BN_exp(d,a,b,ctx)) |
855 | return(00); | 851 | return(00); |
@@ -899,7 +895,7 @@ int test_lshift(BIO *bp,BN_CTX *ctx,BIGNUM *a_) | |||
899 | else | 895 | else |
900 | { | 896 | { |
901 | a=BN_new(); | 897 | a=BN_new(); |
902 | BN_rand(a,200,0,0); /**/ | 898 | BN_bntest_rand(a,200,0,0); /**/ |
903 | a->neg=rand_neg(); | 899 | a->neg=rand_neg(); |
904 | } | 900 | } |
905 | for (i=0; i<num0; i++) | 901 | for (i=0; i<num0; i++) |
@@ -951,7 +947,7 @@ int test_lshift1(BIO *bp) | |||
951 | b=BN_new(); | 947 | b=BN_new(); |
952 | c=BN_new(); | 948 | c=BN_new(); |
953 | 949 | ||
954 | BN_rand(a,200,0,0); /**/ | 950 | BN_bntest_rand(a,200,0,0); /**/ |
955 | a->neg=rand_neg(); | 951 | a->neg=rand_neg(); |
956 | for (i=0; i<num0; i++) | 952 | for (i=0; i<num0; i++) |
957 | { | 953 | { |
@@ -995,7 +991,7 @@ int test_rshift(BIO *bp,BN_CTX *ctx) | |||
995 | e=BN_new(); | 991 | e=BN_new(); |
996 | BN_one(c); | 992 | BN_one(c); |
997 | 993 | ||
998 | BN_rand(a,200,0,0); /**/ | 994 | BN_bntest_rand(a,200,0,0); /**/ |
999 | a->neg=rand_neg(); | 995 | a->neg=rand_neg(); |
1000 | for (i=0; i<num0; i++) | 996 | for (i=0; i<num0; i++) |
1001 | { | 997 | { |
@@ -1038,7 +1034,7 @@ int test_rshift1(BIO *bp) | |||
1038 | b=BN_new(); | 1034 | b=BN_new(); |
1039 | c=BN_new(); | 1035 | c=BN_new(); |
1040 | 1036 | ||
1041 | BN_rand(a,200,0,0); /**/ | 1037 | BN_bntest_rand(a,200,0,0); /**/ |
1042 | a->neg=rand_neg(); | 1038 | a->neg=rand_neg(); |
1043 | for (i=0; i<num0; i++) | 1039 | for (i=0; i<num0; i++) |
1044 | { | 1040 | { |
diff --git a/src/lib/libcrypto/buffer/Makefile.ssl b/src/lib/libcrypto/buffer/Makefile.ssl index f473d1ab4b..a64681fd22 100644 --- a/src/lib/libcrypto/buffer/Makefile.ssl +++ b/src/lib/libcrypto/buffer/Makefile.ssl | |||
@@ -39,7 +39,8 @@ all: lib | |||
39 | 39 | ||
40 | lib: $(LIBOBJ) | 40 | lib: $(LIBOBJ) |
41 | $(AR) $(LIB) $(LIBOBJ) | 41 | $(AR) $(LIB) $(LIBOBJ) |
42 | $(RANLIB) $(LIB) | 42 | @echo You may get an error following this line. Please ignore. |
43 | - $(RANLIB) $(LIB) | ||
43 | @touch lib | 44 | @touch lib |
44 | 45 | ||
45 | files: | 46 | files: |
diff --git a/src/lib/libcrypto/cast/Makefile.ssl b/src/lib/libcrypto/cast/Makefile.ssl index 4c70d1e3e8..1f8b898f7c 100644 --- a/src/lib/libcrypto/cast/Makefile.ssl +++ b/src/lib/libcrypto/cast/Makefile.ssl | |||
@@ -47,7 +47,8 @@ all: lib | |||
47 | 47 | ||
48 | lib: $(LIBOBJ) | 48 | lib: $(LIBOBJ) |
49 | $(AR) $(LIB) $(LIBOBJ) | 49 | $(AR) $(LIB) $(LIBOBJ) |
50 | $(RANLIB) $(LIB) | 50 | @echo You may get an error following this line. Please ignore. |
51 | - $(RANLIB) $(LIB) | ||
51 | @touch lib | 52 | @touch lib |
52 | 53 | ||
53 | # elf | 54 | # elf |
diff --git a/src/lib/libcrypto/comp/Makefile.ssl b/src/lib/libcrypto/comp/Makefile.ssl index 39e7993416..b696ac75fe 100644 --- a/src/lib/libcrypto/comp/Makefile.ssl +++ b/src/lib/libcrypto/comp/Makefile.ssl | |||
@@ -42,7 +42,8 @@ all: lib | |||
42 | 42 | ||
43 | lib: $(LIBOBJ) | 43 | lib: $(LIBOBJ) |
44 | $(AR) $(LIB) $(LIBOBJ) | 44 | $(AR) $(LIB) $(LIBOBJ) |
45 | $(RANLIB) $(LIB) | 45 | @echo You may get an error following this line. Please ignore. |
46 | - $(RANLIB) $(LIB) | ||
46 | @touch lib | 47 | @touch lib |
47 | 48 | ||
48 | files: | 49 | files: |
diff --git a/src/lib/libcrypto/conf/Makefile.ssl b/src/lib/libcrypto/conf/Makefile.ssl index efbb578981..9df4fca877 100644 --- a/src/lib/libcrypto/conf/Makefile.ssl +++ b/src/lib/libcrypto/conf/Makefile.ssl | |||
@@ -40,7 +40,8 @@ all: lib | |||
40 | 40 | ||
41 | lib: $(LIBOBJ) | 41 | lib: $(LIBOBJ) |
42 | $(AR) $(LIB) $(LIBOBJ) | 42 | $(AR) $(LIB) $(LIBOBJ) |
43 | $(RANLIB) $(LIB) | 43 | @echo You may get an error following this line. Please ignore. |
44 | - $(RANLIB) $(LIB) | ||
44 | @touch lib | 45 | @touch lib |
45 | 46 | ||
46 | files: | 47 | files: |
diff --git a/src/lib/libcrypto/conf/conf.h b/src/lib/libcrypto/conf/conf.h index 2f70634455..cd40a0db21 100644 --- a/src/lib/libcrypto/conf/conf.h +++ b/src/lib/libcrypto/conf/conf.h | |||
@@ -167,6 +167,8 @@ int NCONF_dump_bio(CONF *conf, BIO *out); | |||
167 | #define CONF_R_MISSING_EQUAL_SIGN 101 | 167 | #define CONF_R_MISSING_EQUAL_SIGN 101 |
168 | #define CONF_R_NO_CLOSE_BRACE 102 | 168 | #define CONF_R_NO_CLOSE_BRACE 102 |
169 | #define CONF_R_NO_CONF 105 | 169 | #define CONF_R_NO_CONF 105 |
170 | #define CONF_R_NO_CONF_OR_ENVIRONMENT_VARIABLE 106 | ||
171 | #define CONF_R_NO_SECTION 107 | ||
170 | #define CONF_R_UNABLE_TO_CREATE_NEW_SECTION 103 | 172 | #define CONF_R_UNABLE_TO_CREATE_NEW_SECTION 103 |
171 | #define CONF_R_VARIABLE_HAS_NO_VALUE 104 | 173 | #define CONF_R_VARIABLE_HAS_NO_VALUE 104 |
172 | 174 | ||
diff --git a/src/lib/libcrypto/conf/conf_err.c b/src/lib/libcrypto/conf/conf_err.c index 06d3163573..8c2bc6f1c4 100644 --- a/src/lib/libcrypto/conf/conf_err.c +++ b/src/lib/libcrypto/conf/conf_err.c | |||
@@ -87,6 +87,8 @@ static ERR_STRING_DATA CONF_str_reasons[]= | |||
87 | {CONF_R_MISSING_EQUAL_SIGN ,"missing equal sign"}, | 87 | {CONF_R_MISSING_EQUAL_SIGN ,"missing equal sign"}, |
88 | {CONF_R_NO_CLOSE_BRACE ,"no close brace"}, | 88 | {CONF_R_NO_CLOSE_BRACE ,"no close brace"}, |
89 | {CONF_R_NO_CONF ,"no conf"}, | 89 | {CONF_R_NO_CONF ,"no conf"}, |
90 | {CONF_R_NO_CONF_OR_ENVIRONMENT_VARIABLE ,"no conf or environment variable"}, | ||
91 | {CONF_R_NO_SECTION ,"no section"}, | ||
90 | {CONF_R_UNABLE_TO_CREATE_NEW_SECTION ,"unable to create new section"}, | 92 | {CONF_R_UNABLE_TO_CREATE_NEW_SECTION ,"unable to create new section"}, |
91 | {CONF_R_VARIABLE_HAS_NO_VALUE ,"variable has no value"}, | 93 | {CONF_R_VARIABLE_HAS_NO_VALUE ,"variable has no value"}, |
92 | {0,NULL} | 94 | {0,NULL} |
diff --git a/src/lib/libcrypto/conf/conf_lib.c b/src/lib/libcrypto/conf/conf_lib.c index 4c8ca9e9ae..11ec639732 100644 --- a/src/lib/libcrypto/conf/conf_lib.c +++ b/src/lib/libcrypto/conf/conf_lib.c | |||
@@ -131,38 +131,59 @@ LHASH *CONF_load_bio(LHASH *conf, BIO *bp,long *eline) | |||
131 | 131 | ||
132 | STACK_OF(CONF_VALUE) *CONF_get_section(LHASH *conf,char *section) | 132 | STACK_OF(CONF_VALUE) *CONF_get_section(LHASH *conf,char *section) |
133 | { | 133 | { |
134 | CONF ctmp; | 134 | if (conf == NULL) |
135 | { | ||
136 | return NULL; | ||
137 | } | ||
138 | else | ||
139 | { | ||
140 | CONF ctmp; | ||
135 | 141 | ||
136 | if (default_CONF_method == NULL) | 142 | if (default_CONF_method == NULL) |
137 | default_CONF_method = NCONF_default(); | 143 | default_CONF_method = NCONF_default(); |
138 | 144 | ||
139 | default_CONF_method->init(&ctmp); | 145 | default_CONF_method->init(&ctmp); |
140 | ctmp.data = conf; | 146 | ctmp.data = conf; |
141 | return NCONF_get_section(&ctmp, section); | 147 | return NCONF_get_section(&ctmp, section); |
148 | } | ||
142 | } | 149 | } |
143 | 150 | ||
144 | char *CONF_get_string(LHASH *conf,char *group,char *name) | 151 | char *CONF_get_string(LHASH *conf,char *group,char *name) |
145 | { | 152 | { |
146 | CONF ctmp; | 153 | if (conf == NULL) |
154 | { | ||
155 | return NCONF_get_string(NULL, group, name); | ||
156 | } | ||
157 | else | ||
158 | { | ||
159 | CONF ctmp; | ||
147 | 160 | ||
148 | if (default_CONF_method == NULL) | 161 | if (default_CONF_method == NULL) |
149 | default_CONF_method = NCONF_default(); | 162 | default_CONF_method = NCONF_default(); |
150 | 163 | ||
151 | default_CONF_method->init(&ctmp); | 164 | default_CONF_method->init(&ctmp); |
152 | ctmp.data = conf; | 165 | ctmp.data = conf; |
153 | return NCONF_get_string(&ctmp, group, name); | 166 | return NCONF_get_string(&ctmp, group, name); |
167 | } | ||
154 | } | 168 | } |
155 | 169 | ||
156 | long CONF_get_number(LHASH *conf,char *group,char *name) | 170 | long CONF_get_number(LHASH *conf,char *group,char *name) |
157 | { | 171 | { |
158 | CONF ctmp; | 172 | if (conf == NULL) |
173 | { | ||
174 | return NCONF_get_number(NULL, group, name); | ||
175 | } | ||
176 | else | ||
177 | { | ||
178 | CONF ctmp; | ||
159 | 179 | ||
160 | if (default_CONF_method == NULL) | 180 | if (default_CONF_method == NULL) |
161 | default_CONF_method = NCONF_default(); | 181 | default_CONF_method = NCONF_default(); |
162 | 182 | ||
163 | default_CONF_method->init(&ctmp); | 183 | default_CONF_method->init(&ctmp); |
164 | ctmp.data = conf; | 184 | ctmp.data = conf; |
165 | return NCONF_get_number(&ctmp, group, name); | 185 | return NCONF_get_number(&ctmp, group, name); |
186 | } | ||
166 | } | 187 | } |
167 | 188 | ||
168 | void CONF_free(LHASH *conf) | 189 | void CONF_free(LHASH *conf) |
@@ -299,27 +320,46 @@ STACK_OF(CONF_VALUE) *NCONF_get_section(CONF *conf,char *section) | |||
299 | return NULL; | 320 | return NULL; |
300 | } | 321 | } |
301 | 322 | ||
323 | if (section == NULL) | ||
324 | { | ||
325 | CONFerr(CONF_F_NCONF_GET_SECTION,CONF_R_NO_SECTION); | ||
326 | return NULL; | ||
327 | } | ||
328 | |||
302 | return _CONF_get_section_values(conf, section); | 329 | return _CONF_get_section_values(conf, section); |
303 | } | 330 | } |
304 | 331 | ||
305 | char *NCONF_get_string(CONF *conf,char *group,char *name) | 332 | char *NCONF_get_string(CONF *conf,char *group,char *name) |
306 | { | 333 | { |
334 | char *s = _CONF_get_string(conf, group, name); | ||
335 | |||
336 | /* Since we may get a value from an environment variable even | ||
337 | if conf is NULL, let's check the value first */ | ||
338 | if (s) return s; | ||
339 | |||
307 | if (conf == NULL) | 340 | if (conf == NULL) |
308 | { | 341 | { |
309 | CONFerr(CONF_F_NCONF_GET_STRING,CONF_R_NO_CONF); | 342 | CONFerr(CONF_F_NCONF_GET_STRING, |
343 | CONF_R_NO_CONF_OR_ENVIRONMENT_VARIABLE); | ||
310 | return NULL; | 344 | return NULL; |
311 | } | 345 | } |
312 | 346 | return NULL; | |
313 | return _CONF_get_string(conf, group, name); | ||
314 | } | 347 | } |
315 | 348 | ||
316 | long NCONF_get_number(CONF *conf,char *group,char *name) | 349 | long NCONF_get_number(CONF *conf,char *group,char *name) |
317 | { | 350 | { |
351 | #if 0 /* As with _CONF_get_string(), we rely on the possibility of finding | ||
352 | an environment variable with a suitable name. Unfortunately, there's | ||
353 | no way with the current API to see if we found one or not... | ||
354 | The meaning of this is that if a number is not found anywhere, it | ||
355 | will always default to 0. */ | ||
318 | if (conf == NULL) | 356 | if (conf == NULL) |
319 | { | 357 | { |
320 | CONFerr(CONF_F_NCONF_GET_NUMBER,CONF_R_NO_CONF); | 358 | CONFerr(CONF_F_NCONF_GET_NUMBER, |
359 | CONF_R_NO_CONF_OR_ENVIRONMENT_VARIABLE); | ||
321 | return 0; | 360 | return 0; |
322 | } | 361 | } |
362 | #endif | ||
323 | 363 | ||
324 | return _CONF_get_number(conf, group, name); | 364 | return _CONF_get_number(conf, group, name); |
325 | } | 365 | } |
diff --git a/src/lib/libcrypto/crypto-lib.com b/src/lib/libcrypto/crypto-lib.com index 21d56a4b50..482a136177 100644 --- a/src/lib/libcrypto/crypto-lib.com +++ b/src/lib/libcrypto/crypto-lib.com | |||
@@ -174,7 +174,7 @@ $! | |||
174 | $ APPS_DES = "DES/DES,CBC3_ENC" | 174 | $ APPS_DES = "DES/DES,CBC3_ENC" |
175 | $ APPS_PKCS7 = "ENC/ENC;DEC/DEC;SIGN/SIGN;VERIFY/VERIFY,EXAMPLE" | 175 | $ APPS_PKCS7 = "ENC/ENC;DEC/DEC;SIGN/SIGN;VERIFY/VERIFY,EXAMPLE" |
176 | $ | 176 | $ |
177 | $ LIB_ = "cryptlib,mem,mem_dbg,cversion,ex_data,tmdiff,cpt_err" | 177 | $ LIB_ = "cryptlib,mem,mem_dbg,cversion,ex_data,tmdiff,cpt_err,ebcdic,uid" |
178 | $ LIB_MD2 = "md2_dgst,md2_one" | 178 | $ LIB_MD2 = "md2_dgst,md2_one" |
179 | $ LIB_MD4 = "md4_dgst,md4_one" | 179 | $ LIB_MD4 = "md4_dgst,md4_one" |
180 | $ LIB_MD5 = "md5_dgst,md5_one" | 180 | $ LIB_MD5 = "md5_dgst,md5_one" |
diff --git a/src/lib/libcrypto/crypto.h b/src/lib/libcrypto/crypto.h index 52ee97b71a..9257673279 100644 --- a/src/lib/libcrypto/crypto.h +++ b/src/lib/libcrypto/crypto.h | |||
@@ -278,6 +278,8 @@ int CRYPTO_is_mem_check_on(void); | |||
278 | const char *SSLeay_version(int type); | 278 | const char *SSLeay_version(int type); |
279 | unsigned long SSLeay(void); | 279 | unsigned long SSLeay(void); |
280 | 280 | ||
281 | int OPENSSL_issetugid(void); | ||
282 | |||
281 | int CRYPTO_get_ex_new_index(int idx, STACK_OF(CRYPTO_EX_DATA_FUNCS) **skp, long argl, void *argp, | 283 | int CRYPTO_get_ex_new_index(int idx, STACK_OF(CRYPTO_EX_DATA_FUNCS) **skp, long argl, void *argp, |
282 | CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); | 284 | CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); |
283 | int CRYPTO_set_ex_data(CRYPTO_EX_DATA *ad, int idx, void *val); | 285 | int CRYPTO_set_ex_data(CRYPTO_EX_DATA *ad, int idx, void *val); |
diff --git a/src/lib/libcrypto/des/Makefile.ssl b/src/lib/libcrypto/des/Makefile.ssl index 34a360b7ab..cc5379feb2 100644 --- a/src/lib/libcrypto/des/Makefile.ssl +++ b/src/lib/libcrypto/des/Makefile.ssl | |||
@@ -57,7 +57,8 @@ all: lib | |||
57 | 57 | ||
58 | lib: $(LIBOBJ) | 58 | lib: $(LIBOBJ) |
59 | $(AR) $(LIB) $(LIBOBJ) | 59 | $(AR) $(LIB) $(LIBOBJ) |
60 | $(RANLIB) $(LIB) | 60 | @echo You may get an error following this line. Please ignore. |
61 | - $(RANLIB) $(LIB) | ||
61 | @touch lib | 62 | @touch lib |
62 | 63 | ||
63 | des: des.o cbc3_enc.o lib | 64 | des: des.o cbc3_enc.o lib |
diff --git a/src/lib/libcrypto/des/asm/des-586.pl b/src/lib/libcrypto/des/asm/des-586.pl index f054071077..c890766bc9 100644 --- a/src/lib/libcrypto/des/asm/des-586.pl +++ b/src/lib/libcrypto/des/asm/des-586.pl | |||
@@ -20,11 +20,11 @@ $L="edi"; | |||
20 | $R="esi"; | 20 | $R="esi"; |
21 | 21 | ||
22 | &external_label("des_SPtrans"); | 22 | &external_label("des_SPtrans"); |
23 | &des_encrypt("des_encrypt",1); | 23 | &des_encrypt("des_encrypt1",1); |
24 | &des_encrypt("des_encrypt2",0); | 24 | &des_encrypt("des_encrypt2",0); |
25 | &des_encrypt3("des_encrypt3",1); | 25 | &des_encrypt3("des_encrypt3",1); |
26 | &des_encrypt3("des_decrypt3",0); | 26 | &des_encrypt3("des_decrypt3",0); |
27 | &cbc("des_ncbc_encrypt","des_encrypt","des_encrypt",0,4,5,3,5,-1); | 27 | &cbc("des_ncbc_encrypt","des_encrypt1","des_encrypt1",0,4,5,3,5,-1); |
28 | &cbc("des_ede3_cbc_encrypt","des_encrypt3","des_decrypt3",0,6,7,3,4,5); | 28 | &cbc("des_ede3_cbc_encrypt","des_encrypt3","des_decrypt3",0,6,7,3,4,5); |
29 | 29 | ||
30 | &asm_finish(); | 30 | &asm_finish(); |
diff --git a/src/lib/libcrypto/des/asm/des686.pl b/src/lib/libcrypto/des/asm/des686.pl index 77dc5b51cd..84c3e85438 100644 --- a/src/lib/libcrypto/des/asm/des686.pl +++ b/src/lib/libcrypto/des/asm/des686.pl | |||
@@ -46,7 +46,7 @@ EOF | |||
46 | $L="edi"; | 46 | $L="edi"; |
47 | $R="esi"; | 47 | $R="esi"; |
48 | 48 | ||
49 | &des_encrypt("des_encrypt",1); | 49 | &des_encrypt("des_encrypt1",1); |
50 | &des_encrypt("des_encrypt2",0); | 50 | &des_encrypt("des_encrypt2",0); |
51 | 51 | ||
52 | &des_encrypt3("des_encrypt3",1); | 52 | &des_encrypt3("des_encrypt3",1); |
diff --git a/src/lib/libcrypto/des/asm/readme b/src/lib/libcrypto/des/asm/readme index f8529d9307..1beafe253b 100644 --- a/src/lib/libcrypto/des/asm/readme +++ b/src/lib/libcrypto/des/asm/readme | |||
@@ -8,7 +8,7 @@ assembler for the inner DES routines in libdes :-). | |||
8 | 8 | ||
9 | The file to implement in assembler is des_enc.c. Replace the following | 9 | The file to implement in assembler is des_enc.c. Replace the following |
10 | 4 functions | 10 | 4 functions |
11 | des_encrypt(DES_LONG data[2],des_key_schedule ks, int encrypt); | 11 | des_encrypt1(DES_LONG data[2],des_key_schedule ks, int encrypt); |
12 | des_encrypt2(DES_LONG data[2],des_key_schedule ks, int encrypt); | 12 | des_encrypt2(DES_LONG data[2],des_key_schedule ks, int encrypt); |
13 | des_encrypt3(DES_LONG data[2],des_key_schedule ks1,ks2,ks3); | 13 | des_encrypt3(DES_LONG data[2],des_key_schedule ks1,ks2,ks3); |
14 | des_decrypt3(DES_LONG data[2],des_key_schedule ks1,ks2,ks3); | 14 | des_decrypt3(DES_LONG data[2],des_key_schedule ks1,ks2,ks3); |
diff --git a/src/lib/libcrypto/des/cbc_cksm.c b/src/lib/libcrypto/des/cbc_cksm.c index 1e543cb2a1..b857df0985 100644 --- a/src/lib/libcrypto/des/cbc_cksm.c +++ b/src/lib/libcrypto/des/cbc_cksm.c | |||
@@ -82,7 +82,7 @@ DES_LONG des_cbc_cksum(const unsigned char *in, des_cblock *output, | |||
82 | 82 | ||
83 | tin0^=tout0; tin[0]=tin0; | 83 | tin0^=tout0; tin[0]=tin0; |
84 | tin1^=tout1; tin[1]=tin1; | 84 | tin1^=tout1; tin[1]=tin1; |
85 | des_encrypt((DES_LONG *)tin,schedule,DES_ENCRYPT); | 85 | des_encrypt1((DES_LONG *)tin,schedule,DES_ENCRYPT); |
86 | /* fix 15/10/91 eay - thanks to keithr@sco.COM */ | 86 | /* fix 15/10/91 eay - thanks to keithr@sco.COM */ |
87 | tout0=tin[0]; | 87 | tout0=tin[0]; |
88 | tout1=tin[1]; | 88 | tout1=tin[1]; |
diff --git a/src/lib/libcrypto/des/cfb64enc.c b/src/lib/libcrypto/des/cfb64enc.c index 389a232cb3..105530dfa3 100644 --- a/src/lib/libcrypto/des/cfb64enc.c +++ b/src/lib/libcrypto/des/cfb64enc.c | |||
@@ -82,7 +82,7 @@ void des_cfb64_encrypt(const unsigned char *in, unsigned char *out, | |||
82 | { | 82 | { |
83 | c2l(iv,v0); ti[0]=v0; | 83 | c2l(iv,v0); ti[0]=v0; |
84 | c2l(iv,v1); ti[1]=v1; | 84 | c2l(iv,v1); ti[1]=v1; |
85 | des_encrypt(ti,schedule,DES_ENCRYPT); | 85 | des_encrypt1(ti,schedule,DES_ENCRYPT); |
86 | iv = &(*ivec)[0]; | 86 | iv = &(*ivec)[0]; |
87 | v0=ti[0]; l2c(v0,iv); | 87 | v0=ti[0]; l2c(v0,iv); |
88 | v0=ti[1]; l2c(v0,iv); | 88 | v0=ti[1]; l2c(v0,iv); |
@@ -102,7 +102,7 @@ void des_cfb64_encrypt(const unsigned char *in, unsigned char *out, | |||
102 | { | 102 | { |
103 | c2l(iv,v0); ti[0]=v0; | 103 | c2l(iv,v0); ti[0]=v0; |
104 | c2l(iv,v1); ti[1]=v1; | 104 | c2l(iv,v1); ti[1]=v1; |
105 | des_encrypt(ti,schedule,DES_ENCRYPT); | 105 | des_encrypt1(ti,schedule,DES_ENCRYPT); |
106 | iv = &(*ivec)[0]; | 106 | iv = &(*ivec)[0]; |
107 | v0=ti[0]; l2c(v0,iv); | 107 | v0=ti[0]; l2c(v0,iv); |
108 | v0=ti[1]; l2c(v0,iv); | 108 | v0=ti[1]; l2c(v0,iv); |
diff --git a/src/lib/libcrypto/des/cfb_enc.c b/src/lib/libcrypto/des/cfb_enc.c index cca34dd7c5..ec4fd4ea67 100644 --- a/src/lib/libcrypto/des/cfb_enc.c +++ b/src/lib/libcrypto/des/cfb_enc.c | |||
@@ -100,7 +100,7 @@ void des_cfb_encrypt(const unsigned char *in, unsigned char *out, int numbits, | |||
100 | l-=n; | 100 | l-=n; |
101 | ti[0]=v0; | 101 | ti[0]=v0; |
102 | ti[1]=v1; | 102 | ti[1]=v1; |
103 | des_encrypt((DES_LONG *)ti,schedule,DES_ENCRYPT); | 103 | des_encrypt1((DES_LONG *)ti,schedule,DES_ENCRYPT); |
104 | c2ln(in,d0,d1,n); | 104 | c2ln(in,d0,d1,n); |
105 | in+=n; | 105 | in+=n; |
106 | d0=(d0^ti[0])&mask0; | 106 | d0=(d0^ti[0])&mask0; |
@@ -132,7 +132,7 @@ void des_cfb_encrypt(const unsigned char *in, unsigned char *out, int numbits, | |||
132 | l-=n; | 132 | l-=n; |
133 | ti[0]=v0; | 133 | ti[0]=v0; |
134 | ti[1]=v1; | 134 | ti[1]=v1; |
135 | des_encrypt((DES_LONG *)ti,schedule,DES_ENCRYPT); | 135 | des_encrypt1((DES_LONG *)ti,schedule,DES_ENCRYPT); |
136 | c2ln(in,d0,d1,n); | 136 | c2ln(in,d0,d1,n); |
137 | in+=n; | 137 | in+=n; |
138 | /* 30-08-94 - eay - changed because l>>32 and | 138 | /* 30-08-94 - eay - changed because l>>32 and |
diff --git a/src/lib/libcrypto/des/des.h b/src/lib/libcrypto/des/des.h index 2db9748cb4..6b8a7ee11b 100644 --- a/src/lib/libcrypto/des/des.h +++ b/src/lib/libcrypto/des/des.h | |||
@@ -147,14 +147,14 @@ void des_ecb_encrypt(const_des_cblock *input,des_cblock *output, | |||
147 | Data is a pointer to 2 unsigned long's and ks is the | 147 | Data is a pointer to 2 unsigned long's and ks is the |
148 | des_key_schedule to use. enc, is non zero specifies encryption, | 148 | des_key_schedule to use. enc, is non zero specifies encryption, |
149 | zero if decryption. */ | 149 | zero if decryption. */ |
150 | void des_encrypt(DES_LONG *data,des_key_schedule ks, int enc); | 150 | void des_encrypt1(DES_LONG *data,des_key_schedule ks, int enc); |
151 | 151 | ||
152 | /* This functions is the same as des_encrypt() except that the DES | 152 | /* This functions is the same as des_encrypt1() except that the DES |
153 | initial permutation (IP) and final permutation (FP) have been left | 153 | initial permutation (IP) and final permutation (FP) have been left |
154 | out. As for des_encrypt(), you should not use this function. | 154 | out. As for des_encrypt1(), you should not use this function. |
155 | It is used by the routines in the library that implement triple DES. | 155 | It is used by the routines in the library that implement triple DES. |
156 | IP() des_encrypt2() des_encrypt2() des_encrypt2() FP() is the same | 156 | IP() des_encrypt2() des_encrypt2() des_encrypt2() FP() is the same |
157 | as des_encrypt() des_encrypt() des_encrypt() except faster :-). */ | 157 | as des_encrypt1() des_encrypt1() des_encrypt1() except faster :-). */ |
158 | void des_encrypt2(DES_LONG *data,des_key_schedule ks, int enc); | 158 | void des_encrypt2(DES_LONG *data,des_key_schedule ks, int enc); |
159 | 159 | ||
160 | void des_encrypt3(DES_LONG *data, des_key_schedule ks1, | 160 | void des_encrypt3(DES_LONG *data, des_key_schedule ks1, |
diff --git a/src/lib/libcrypto/des/des_enc.c b/src/lib/libcrypto/des/des_enc.c index 8311e10628..0bd9fa39bc 100644 --- a/src/lib/libcrypto/des/des_enc.c +++ b/src/lib/libcrypto/des/des_enc.c | |||
@@ -58,7 +58,7 @@ | |||
58 | 58 | ||
59 | #include "des_locl.h" | 59 | #include "des_locl.h" |
60 | 60 | ||
61 | void des_encrypt(DES_LONG *data, des_key_schedule ks, int enc) | 61 | void des_encrypt1(DES_LONG *data, des_key_schedule ks, int enc) |
62 | { | 62 | { |
63 | register DES_LONG l,r,t,u; | 63 | register DES_LONG l,r,t,u; |
64 | #ifdef DES_PTR | 64 | #ifdef DES_PTR |
diff --git a/src/lib/libcrypto/des/des_opts.c b/src/lib/libcrypto/des/des_opts.c index b2ca7ac31d..138ee1c6b4 100644 --- a/src/lib/libcrypto/des/des_opts.c +++ b/src/lib/libcrypto/des/des_opts.c | |||
@@ -118,7 +118,7 @@ extern void exit(); | |||
118 | #undef DES_RISC2 | 118 | #undef DES_RISC2 |
119 | #undef DES_PTR | 119 | #undef DES_PTR |
120 | #undef D_ENCRYPT | 120 | #undef D_ENCRYPT |
121 | #define des_encrypt des_encrypt_u4_cisc_idx | 121 | #define des_encrypt1 des_encrypt_u4_cisc_idx |
122 | #define des_encrypt2 des_encrypt2_u4_cisc_idx | 122 | #define des_encrypt2 des_encrypt2_u4_cisc_idx |
123 | #define des_encrypt3 des_encrypt3_u4_cisc_idx | 123 | #define des_encrypt3 des_encrypt3_u4_cisc_idx |
124 | #define des_decrypt3 des_decrypt3_u4_cisc_idx | 124 | #define des_decrypt3 des_decrypt3_u4_cisc_idx |
@@ -130,11 +130,11 @@ extern void exit(); | |||
130 | #undef DES_RISC2 | 130 | #undef DES_RISC2 |
131 | #undef DES_PTR | 131 | #undef DES_PTR |
132 | #undef D_ENCRYPT | 132 | #undef D_ENCRYPT |
133 | #undef des_encrypt | 133 | #undef des_encrypt1 |
134 | #undef des_encrypt2 | 134 | #undef des_encrypt2 |
135 | #undef des_encrypt3 | 135 | #undef des_encrypt3 |
136 | #undef des_decrypt3 | 136 | #undef des_decrypt3 |
137 | #define des_encrypt des_encrypt_u16_cisc_idx | 137 | #define des_encrypt1 des_encrypt_u16_cisc_idx |
138 | #define des_encrypt2 des_encrypt2_u16_cisc_idx | 138 | #define des_encrypt2 des_encrypt2_u16_cisc_idx |
139 | #define des_encrypt3 des_encrypt3_u16_cisc_idx | 139 | #define des_encrypt3 des_encrypt3_u16_cisc_idx |
140 | #define des_decrypt3 des_decrypt3_u16_cisc_idx | 140 | #define des_decrypt3 des_decrypt3_u16_cisc_idx |
@@ -146,11 +146,11 @@ extern void exit(); | |||
146 | #undef DES_RISC2 | 146 | #undef DES_RISC2 |
147 | #undef DES_PTR | 147 | #undef DES_PTR |
148 | #undef D_ENCRYPT | 148 | #undef D_ENCRYPT |
149 | #undef des_encrypt | 149 | #undef des_encrypt1 |
150 | #undef des_encrypt2 | 150 | #undef des_encrypt2 |
151 | #undef des_encrypt3 | 151 | #undef des_encrypt3 |
152 | #undef des_decrypt3 | 152 | #undef des_decrypt3 |
153 | #define des_encrypt des_encrypt_u4_risc1_idx | 153 | #define des_encrypt1 des_encrypt_u4_risc1_idx |
154 | #define des_encrypt2 des_encrypt2_u4_risc1_idx | 154 | #define des_encrypt2 des_encrypt2_u4_risc1_idx |
155 | #define des_encrypt3 des_encrypt3_u4_risc1_idx | 155 | #define des_encrypt3 des_encrypt3_u4_risc1_idx |
156 | #define des_decrypt3 des_decrypt3_u4_risc1_idx | 156 | #define des_decrypt3 des_decrypt3_u4_risc1_idx |
@@ -166,11 +166,11 @@ extern void exit(); | |||
166 | #define DES_RISC2 | 166 | #define DES_RISC2 |
167 | #undef DES_PTR | 167 | #undef DES_PTR |
168 | #undef D_ENCRYPT | 168 | #undef D_ENCRYPT |
169 | #undef des_encrypt | 169 | #undef des_encrypt1 |
170 | #undef des_encrypt2 | 170 | #undef des_encrypt2 |
171 | #undef des_encrypt3 | 171 | #undef des_encrypt3 |
172 | #undef des_decrypt3 | 172 | #undef des_decrypt3 |
173 | #define des_encrypt des_encrypt_u4_risc2_idx | 173 | #define des_encrypt1 des_encrypt_u4_risc2_idx |
174 | #define des_encrypt2 des_encrypt2_u4_risc2_idx | 174 | #define des_encrypt2 des_encrypt2_u4_risc2_idx |
175 | #define des_encrypt3 des_encrypt3_u4_risc2_idx | 175 | #define des_encrypt3 des_encrypt3_u4_risc2_idx |
176 | #define des_decrypt3 des_decrypt3_u4_risc2_idx | 176 | #define des_decrypt3 des_decrypt3_u4_risc2_idx |
@@ -182,11 +182,11 @@ extern void exit(); | |||
182 | #undef DES_RISC2 | 182 | #undef DES_RISC2 |
183 | #undef DES_PTR | 183 | #undef DES_PTR |
184 | #undef D_ENCRYPT | 184 | #undef D_ENCRYPT |
185 | #undef des_encrypt | 185 | #undef des_encrypt1 |
186 | #undef des_encrypt2 | 186 | #undef des_encrypt2 |
187 | #undef des_encrypt3 | 187 | #undef des_encrypt3 |
188 | #undef des_decrypt3 | 188 | #undef des_decrypt3 |
189 | #define des_encrypt des_encrypt_u16_risc1_idx | 189 | #define des_encrypt1 des_encrypt_u16_risc1_idx |
190 | #define des_encrypt2 des_encrypt2_u16_risc1_idx | 190 | #define des_encrypt2 des_encrypt2_u16_risc1_idx |
191 | #define des_encrypt3 des_encrypt3_u16_risc1_idx | 191 | #define des_encrypt3 des_encrypt3_u16_risc1_idx |
192 | #define des_decrypt3 des_decrypt3_u16_risc1_idx | 192 | #define des_decrypt3 des_decrypt3_u16_risc1_idx |
@@ -198,11 +198,11 @@ extern void exit(); | |||
198 | #define DES_RISC2 | 198 | #define DES_RISC2 |
199 | #undef DES_PTR | 199 | #undef DES_PTR |
200 | #undef D_ENCRYPT | 200 | #undef D_ENCRYPT |
201 | #undef des_encrypt | 201 | #undef des_encrypt1 |
202 | #undef des_encrypt2 | 202 | #undef des_encrypt2 |
203 | #undef des_encrypt3 | 203 | #undef des_encrypt3 |
204 | #undef des_decrypt3 | 204 | #undef des_decrypt3 |
205 | #define des_encrypt des_encrypt_u16_risc2_idx | 205 | #define des_encrypt1 des_encrypt_u16_risc2_idx |
206 | #define des_encrypt2 des_encrypt2_u16_risc2_idx | 206 | #define des_encrypt2 des_encrypt2_u16_risc2_idx |
207 | #define des_encrypt3 des_encrypt3_u16_risc2_idx | 207 | #define des_encrypt3 des_encrypt3_u16_risc2_idx |
208 | #define des_decrypt3 des_decrypt3_u16_risc2_idx | 208 | #define des_decrypt3 des_decrypt3_u16_risc2_idx |
@@ -218,11 +218,11 @@ extern void exit(); | |||
218 | #undef DES_RISC2 | 218 | #undef DES_RISC2 |
219 | #define DES_PTR | 219 | #define DES_PTR |
220 | #undef D_ENCRYPT | 220 | #undef D_ENCRYPT |
221 | #undef des_encrypt | 221 | #undef des_encrypt1 |
222 | #undef des_encrypt2 | 222 | #undef des_encrypt2 |
223 | #undef des_encrypt3 | 223 | #undef des_encrypt3 |
224 | #undef des_decrypt3 | 224 | #undef des_decrypt3 |
225 | #define des_encrypt des_encrypt_u4_cisc_ptr | 225 | #define des_encrypt1 des_encrypt_u4_cisc_ptr |
226 | #define des_encrypt2 des_encrypt2_u4_cisc_ptr | 226 | #define des_encrypt2 des_encrypt2_u4_cisc_ptr |
227 | #define des_encrypt3 des_encrypt3_u4_cisc_ptr | 227 | #define des_encrypt3 des_encrypt3_u4_cisc_ptr |
228 | #define des_decrypt3 des_decrypt3_u4_cisc_ptr | 228 | #define des_decrypt3 des_decrypt3_u4_cisc_ptr |
@@ -234,11 +234,11 @@ extern void exit(); | |||
234 | #undef DES_RISC2 | 234 | #undef DES_RISC2 |
235 | #define DES_PTR | 235 | #define DES_PTR |
236 | #undef D_ENCRYPT | 236 | #undef D_ENCRYPT |
237 | #undef des_encrypt | 237 | #undef des_encrypt1 |
238 | #undef des_encrypt2 | 238 | #undef des_encrypt2 |
239 | #undef des_encrypt3 | 239 | #undef des_encrypt3 |
240 | #undef des_decrypt3 | 240 | #undef des_decrypt3 |
241 | #define des_encrypt des_encrypt_u16_cisc_ptr | 241 | #define des_encrypt1 des_encrypt_u16_cisc_ptr |
242 | #define des_encrypt2 des_encrypt2_u16_cisc_ptr | 242 | #define des_encrypt2 des_encrypt2_u16_cisc_ptr |
243 | #define des_encrypt3 des_encrypt3_u16_cisc_ptr | 243 | #define des_encrypt3 des_encrypt3_u16_cisc_ptr |
244 | #define des_decrypt3 des_decrypt3_u16_cisc_ptr | 244 | #define des_decrypt3 des_decrypt3_u16_cisc_ptr |
@@ -250,11 +250,11 @@ extern void exit(); | |||
250 | #undef DES_RISC2 | 250 | #undef DES_RISC2 |
251 | #define DES_PTR | 251 | #define DES_PTR |
252 | #undef D_ENCRYPT | 252 | #undef D_ENCRYPT |
253 | #undef des_encrypt | 253 | #undef des_encrypt1 |
254 | #undef des_encrypt2 | 254 | #undef des_encrypt2 |
255 | #undef des_encrypt3 | 255 | #undef des_encrypt3 |
256 | #undef des_decrypt3 | 256 | #undef des_decrypt3 |
257 | #define des_encrypt des_encrypt_u4_risc1_ptr | 257 | #define des_encrypt1 des_encrypt_u4_risc1_ptr |
258 | #define des_encrypt2 des_encrypt2_u4_risc1_ptr | 258 | #define des_encrypt2 des_encrypt2_u4_risc1_ptr |
259 | #define des_encrypt3 des_encrypt3_u4_risc1_ptr | 259 | #define des_encrypt3 des_encrypt3_u4_risc1_ptr |
260 | #define des_decrypt3 des_decrypt3_u4_risc1_ptr | 260 | #define des_decrypt3 des_decrypt3_u4_risc1_ptr |
@@ -270,11 +270,11 @@ extern void exit(); | |||
270 | #define DES_RISC2 | 270 | #define DES_RISC2 |
271 | #define DES_PTR | 271 | #define DES_PTR |
272 | #undef D_ENCRYPT | 272 | #undef D_ENCRYPT |
273 | #undef des_encrypt | 273 | #undef des_encrypt1 |
274 | #undef des_encrypt2 | 274 | #undef des_encrypt2 |
275 | #undef des_encrypt3 | 275 | #undef des_encrypt3 |
276 | #undef des_decrypt3 | 276 | #undef des_decrypt3 |
277 | #define des_encrypt des_encrypt_u4_risc2_ptr | 277 | #define des_encrypt1 des_encrypt_u4_risc2_ptr |
278 | #define des_encrypt2 des_encrypt2_u4_risc2_ptr | 278 | #define des_encrypt2 des_encrypt2_u4_risc2_ptr |
279 | #define des_encrypt3 des_encrypt3_u4_risc2_ptr | 279 | #define des_encrypt3 des_encrypt3_u4_risc2_ptr |
280 | #define des_decrypt3 des_decrypt3_u4_risc2_ptr | 280 | #define des_decrypt3 des_decrypt3_u4_risc2_ptr |
@@ -286,11 +286,11 @@ extern void exit(); | |||
286 | #undef DES_RISC2 | 286 | #undef DES_RISC2 |
287 | #define DES_PTR | 287 | #define DES_PTR |
288 | #undef D_ENCRYPT | 288 | #undef D_ENCRYPT |
289 | #undef des_encrypt | 289 | #undef des_encrypt1 |
290 | #undef des_encrypt2 | 290 | #undef des_encrypt2 |
291 | #undef des_encrypt3 | 291 | #undef des_encrypt3 |
292 | #undef des_decrypt3 | 292 | #undef des_decrypt3 |
293 | #define des_encrypt des_encrypt_u16_risc1_ptr | 293 | #define des_encrypt1 des_encrypt_u16_risc1_ptr |
294 | #define des_encrypt2 des_encrypt2_u16_risc1_ptr | 294 | #define des_encrypt2 des_encrypt2_u16_risc1_ptr |
295 | #define des_encrypt3 des_encrypt3_u16_risc1_ptr | 295 | #define des_encrypt3 des_encrypt3_u16_risc1_ptr |
296 | #define des_decrypt3 des_decrypt3_u16_risc1_ptr | 296 | #define des_decrypt3 des_decrypt3_u16_risc1_ptr |
@@ -302,11 +302,11 @@ extern void exit(); | |||
302 | #define DES_RISC2 | 302 | #define DES_RISC2 |
303 | #define DES_PTR | 303 | #define DES_PTR |
304 | #undef D_ENCRYPT | 304 | #undef D_ENCRYPT |
305 | #undef des_encrypt | 305 | #undef des_encrypt1 |
306 | #undef des_encrypt2 | 306 | #undef des_encrypt2 |
307 | #undef des_encrypt3 | 307 | #undef des_encrypt3 |
308 | #undef des_decrypt3 | 308 | #undef des_decrypt3 |
309 | #define des_encrypt des_encrypt_u16_risc2_ptr | 309 | #define des_encrypt1 des_encrypt_u16_risc2_ptr |
310 | #define des_encrypt2 des_encrypt2_u16_risc2_ptr | 310 | #define des_encrypt2 des_encrypt2_u16_risc2_ptr |
311 | #define des_encrypt3 des_encrypt3_u16_risc2_ptr | 311 | #define des_encrypt3 des_encrypt3_u16_risc2_ptr |
312 | #define des_decrypt3 des_decrypt3_u16_risc2_ptr | 312 | #define des_decrypt3 des_decrypt3_u16_risc2_ptr |
@@ -453,7 +453,7 @@ int main(int argc, char **argv) | |||
453 | count*=2; | 453 | count*=2; |
454 | Time_F(START); | 454 | Time_F(START); |
455 | for (i=count; i; i--) | 455 | for (i=count; i; i--) |
456 | des_encrypt(data,&(sch[0]),DES_ENCRYPT); | 456 | des_encrypt1(data,&(sch[0]),DES_ENCRYPT); |
457 | d=Time_F(STOP); | 457 | d=Time_F(STOP); |
458 | } while (d < 3.0); | 458 | } while (d < 3.0); |
459 | ca=count; | 459 | ca=count; |
diff --git a/src/lib/libcrypto/des/dess.cpp b/src/lib/libcrypto/des/dess.cpp index 753e67ad9b..5549bab90a 100644 --- a/src/lib/libcrypto/des/dess.cpp +++ b/src/lib/libcrypto/des/dess.cpp | |||
@@ -45,19 +45,19 @@ void main(int argc,char *argv[]) | |||
45 | { | 45 | { |
46 | for (i=0; i<1000; i++) /**/ | 46 | for (i=0; i<1000; i++) /**/ |
47 | { | 47 | { |
48 | des_encrypt(&data[0],key,1); | 48 | des_encrypt1(&data[0],key,1); |
49 | GetTSC(s1); | 49 | GetTSC(s1); |
50 | des_encrypt(&data[0],key,1); | 50 | des_encrypt1(&data[0],key,1); |
51 | des_encrypt(&data[0],key,1); | 51 | des_encrypt1(&data[0],key,1); |
52 | des_encrypt(&data[0],key,1); | 52 | des_encrypt1(&data[0],key,1); |
53 | GetTSC(e1); | 53 | GetTSC(e1); |
54 | GetTSC(s2); | 54 | GetTSC(s2); |
55 | des_encrypt(&data[0],key,1); | 55 | des_encrypt1(&data[0],key,1); |
56 | des_encrypt(&data[0],key,1); | 56 | des_encrypt1(&data[0],key,1); |
57 | des_encrypt(&data[0],key,1); | 57 | des_encrypt1(&data[0],key,1); |
58 | des_encrypt(&data[0],key,1); | 58 | des_encrypt1(&data[0],key,1); |
59 | GetTSC(e2); | 59 | GetTSC(e2); |
60 | des_encrypt(&data[0],key,1); | 60 | des_encrypt1(&data[0],key,1); |
61 | } | 61 | } |
62 | 62 | ||
63 | printf("des %d %d (%d)\n", | 63 | printf("des %d %d (%d)\n", |
diff --git a/src/lib/libcrypto/des/ecb_enc.c b/src/lib/libcrypto/des/ecb_enc.c index b261a8aad9..d481327ef3 100644 --- a/src/lib/libcrypto/des/ecb_enc.c +++ b/src/lib/libcrypto/des/ecb_enc.c | |||
@@ -114,7 +114,7 @@ void des_ecb_encrypt(const_des_cblock *input, des_cblock *output, | |||
114 | 114 | ||
115 | c2l(in,l); ll[0]=l; | 115 | c2l(in,l); ll[0]=l; |
116 | c2l(in,l); ll[1]=l; | 116 | c2l(in,l); ll[1]=l; |
117 | des_encrypt(ll,ks,enc); | 117 | des_encrypt1(ll,ks,enc); |
118 | l=ll[0]; l2c(l,out); | 118 | l=ll[0]; l2c(l,out); |
119 | l=ll[1]; l2c(l,out); | 119 | l=ll[1]; l2c(l,out); |
120 | l=ll[0]=ll[1]=0; | 120 | l=ll[0]=ll[1]=0; |
diff --git a/src/lib/libcrypto/des/ede_cbcm_enc.c b/src/lib/libcrypto/des/ede_cbcm_enc.c index c53062481d..b98f7e17af 100644 --- a/src/lib/libcrypto/des/ede_cbcm_enc.c +++ b/src/lib/libcrypto/des/ede_cbcm_enc.c | |||
@@ -95,7 +95,7 @@ void des_ede3_cbcm_encrypt(const unsigned char *in, unsigned char *out, | |||
95 | { | 95 | { |
96 | tin[0]=m0; | 96 | tin[0]=m0; |
97 | tin[1]=m1; | 97 | tin[1]=m1; |
98 | des_encrypt(tin,ks3,1); | 98 | des_encrypt1(tin,ks3,1); |
99 | m0=tin[0]; | 99 | m0=tin[0]; |
100 | m1=tin[1]; | 100 | m1=tin[1]; |
101 | 101 | ||
@@ -113,13 +113,13 @@ void des_ede3_cbcm_encrypt(const unsigned char *in, unsigned char *out, | |||
113 | 113 | ||
114 | tin[0]=tin0; | 114 | tin[0]=tin0; |
115 | tin[1]=tin1; | 115 | tin[1]=tin1; |
116 | des_encrypt(tin,ks1,1); | 116 | des_encrypt1(tin,ks1,1); |
117 | tin[0]^=m0; | 117 | tin[0]^=m0; |
118 | tin[1]^=m1; | 118 | tin[1]^=m1; |
119 | des_encrypt(tin,ks2,0); | 119 | des_encrypt1(tin,ks2,0); |
120 | tin[0]^=m0; | 120 | tin[0]^=m0; |
121 | tin[1]^=m1; | 121 | tin[1]^=m1; |
122 | des_encrypt(tin,ks1,1); | 122 | des_encrypt1(tin,ks1,1); |
123 | tout0=tin[0]; | 123 | tout0=tin[0]; |
124 | tout1=tin[1]; | 124 | tout1=tin[1]; |
125 | 125 | ||
@@ -146,7 +146,7 @@ void des_ede3_cbcm_encrypt(const unsigned char *in, unsigned char *out, | |||
146 | { | 146 | { |
147 | tin[0]=m0; | 147 | tin[0]=m0; |
148 | tin[1]=m1; | 148 | tin[1]=m1; |
149 | des_encrypt(tin,ks3,1); | 149 | des_encrypt1(tin,ks3,1); |
150 | m0=tin[0]; | 150 | m0=tin[0]; |
151 | m1=tin[1]; | 151 | m1=tin[1]; |
152 | 152 | ||
@@ -158,13 +158,13 @@ void des_ede3_cbcm_encrypt(const unsigned char *in, unsigned char *out, | |||
158 | 158 | ||
159 | tin[0]=tin0; | 159 | tin[0]=tin0; |
160 | tin[1]=tin1; | 160 | tin[1]=tin1; |
161 | des_encrypt(tin,ks1,0); | 161 | des_encrypt1(tin,ks1,0); |
162 | tin[0]^=m0; | 162 | tin[0]^=m0; |
163 | tin[1]^=m1; | 163 | tin[1]^=m1; |
164 | des_encrypt(tin,ks2,1); | 164 | des_encrypt1(tin,ks2,1); |
165 | tin[0]^=m0; | 165 | tin[0]^=m0; |
166 | tin[1]^=m1; | 166 | tin[1]^=m1; |
167 | des_encrypt(tin,ks1,0); | 167 | des_encrypt1(tin,ks1,0); |
168 | tout0=tin[0]; | 168 | tout0=tin[0]; |
169 | tout1=tin[1]; | 169 | tout1=tin[1]; |
170 | 170 | ||
diff --git a/src/lib/libcrypto/des/ncbc_enc.c b/src/lib/libcrypto/des/ncbc_enc.c index 3b681691a9..b8db07b199 100644 --- a/src/lib/libcrypto/des/ncbc_enc.c +++ b/src/lib/libcrypto/des/ncbc_enc.c | |||
@@ -89,7 +89,7 @@ void des_ncbc_encrypt(const unsigned char *in, unsigned char *out, long length, | |||
89 | c2l(in,tin1); | 89 | c2l(in,tin1); |
90 | tin0^=tout0; tin[0]=tin0; | 90 | tin0^=tout0; tin[0]=tin0; |
91 | tin1^=tout1; tin[1]=tin1; | 91 | tin1^=tout1; tin[1]=tin1; |
92 | des_encrypt((DES_LONG *)tin,schedule,DES_ENCRYPT); | 92 | des_encrypt1((DES_LONG *)tin,schedule,DES_ENCRYPT); |
93 | tout0=tin[0]; l2c(tout0,out); | 93 | tout0=tin[0]; l2c(tout0,out); |
94 | tout1=tin[1]; l2c(tout1,out); | 94 | tout1=tin[1]; l2c(tout1,out); |
95 | } | 95 | } |
@@ -98,7 +98,7 @@ void des_ncbc_encrypt(const unsigned char *in, unsigned char *out, long length, | |||
98 | c2ln(in,tin0,tin1,l+8); | 98 | c2ln(in,tin0,tin1,l+8); |
99 | tin0^=tout0; tin[0]=tin0; | 99 | tin0^=tout0; tin[0]=tin0; |
100 | tin1^=tout1; tin[1]=tin1; | 100 | tin1^=tout1; tin[1]=tin1; |
101 | des_encrypt((DES_LONG *)tin,schedule,DES_ENCRYPT); | 101 | des_encrypt1((DES_LONG *)tin,schedule,DES_ENCRYPT); |
102 | tout0=tin[0]; l2c(tout0,out); | 102 | tout0=tin[0]; l2c(tout0,out); |
103 | tout1=tin[1]; l2c(tout1,out); | 103 | tout1=tin[1]; l2c(tout1,out); |
104 | } | 104 | } |
@@ -116,7 +116,7 @@ void des_ncbc_encrypt(const unsigned char *in, unsigned char *out, long length, | |||
116 | { | 116 | { |
117 | c2l(in,tin0); tin[0]=tin0; | 117 | c2l(in,tin0); tin[0]=tin0; |
118 | c2l(in,tin1); tin[1]=tin1; | 118 | c2l(in,tin1); tin[1]=tin1; |
119 | des_encrypt((DES_LONG *)tin,schedule,DES_DECRYPT); | 119 | des_encrypt1((DES_LONG *)tin,schedule,DES_DECRYPT); |
120 | tout0=tin[0]^xor0; | 120 | tout0=tin[0]^xor0; |
121 | tout1=tin[1]^xor1; | 121 | tout1=tin[1]^xor1; |
122 | l2c(tout0,out); | 122 | l2c(tout0,out); |
@@ -128,7 +128,7 @@ void des_ncbc_encrypt(const unsigned char *in, unsigned char *out, long length, | |||
128 | { | 128 | { |
129 | c2l(in,tin0); tin[0]=tin0; | 129 | c2l(in,tin0); tin[0]=tin0; |
130 | c2l(in,tin1); tin[1]=tin1; | 130 | c2l(in,tin1); tin[1]=tin1; |
131 | des_encrypt((DES_LONG *)tin,schedule,DES_DECRYPT); | 131 | des_encrypt1((DES_LONG *)tin,schedule,DES_DECRYPT); |
132 | tout0=tin[0]^xor0; | 132 | tout0=tin[0]^xor0; |
133 | tout1=tin[1]^xor1; | 133 | tout1=tin[1]^xor1; |
134 | l2cn(tout0,tout1,out,l+8); | 134 | l2cn(tout0,tout1,out,l+8); |
diff --git a/src/lib/libcrypto/des/ofb64enc.c b/src/lib/libcrypto/des/ofb64enc.c index 64953959ca..1a1d1f1ac4 100644 --- a/src/lib/libcrypto/des/ofb64enc.c +++ b/src/lib/libcrypto/des/ofb64enc.c | |||
@@ -87,7 +87,7 @@ void des_ofb64_encrypt(register const unsigned char *in, | |||
87 | { | 87 | { |
88 | if (n == 0) | 88 | if (n == 0) |
89 | { | 89 | { |
90 | des_encrypt(ti,schedule,DES_ENCRYPT); | 90 | des_encrypt1(ti,schedule,DES_ENCRYPT); |
91 | dp=d; | 91 | dp=d; |
92 | t=ti[0]; l2c(t,dp); | 92 | t=ti[0]; l2c(t,dp); |
93 | t=ti[1]; l2c(t,dp); | 93 | t=ti[1]; l2c(t,dp); |
diff --git a/src/lib/libcrypto/des/ofb_enc.c b/src/lib/libcrypto/des/ofb_enc.c index a8f425a575..70493e632c 100644 --- a/src/lib/libcrypto/des/ofb_enc.c +++ b/src/lib/libcrypto/des/ofb_enc.c | |||
@@ -101,7 +101,7 @@ void des_ofb_encrypt(const unsigned char *in, unsigned char *out, int numbits, | |||
101 | { | 101 | { |
102 | ti[0]=v0; | 102 | ti[0]=v0; |
103 | ti[1]=v1; | 103 | ti[1]=v1; |
104 | des_encrypt((DES_LONG *)ti,schedule,DES_ENCRYPT); | 104 | des_encrypt1((DES_LONG *)ti,schedule,DES_ENCRYPT); |
105 | vv0=ti[0]; | 105 | vv0=ti[0]; |
106 | vv1=ti[1]; | 106 | vv1=ti[1]; |
107 | c2ln(in,d0,d1,n); | 107 | c2ln(in,d0,d1,n); |
diff --git a/src/lib/libcrypto/des/pcbc_enc.c b/src/lib/libcrypto/des/pcbc_enc.c index dd69a26d4a..5b987f074d 100644 --- a/src/lib/libcrypto/des/pcbc_enc.c +++ b/src/lib/libcrypto/des/pcbc_enc.c | |||
@@ -85,7 +85,7 @@ void des_pcbc_encrypt(const unsigned char *input, unsigned char *output, | |||
85 | c2ln(in,sin0,sin1,length); | 85 | c2ln(in,sin0,sin1,length); |
86 | tin[0]=sin0^xor0; | 86 | tin[0]=sin0^xor0; |
87 | tin[1]=sin1^xor1; | 87 | tin[1]=sin1^xor1; |
88 | des_encrypt((DES_LONG *)tin,schedule,DES_ENCRYPT); | 88 | des_encrypt1((DES_LONG *)tin,schedule,DES_ENCRYPT); |
89 | tout0=tin[0]; | 89 | tout0=tin[0]; |
90 | tout1=tin[1]; | 90 | tout1=tin[1]; |
91 | xor0=sin0^tout0; | 91 | xor0=sin0^tout0; |
@@ -103,7 +103,7 @@ void des_pcbc_encrypt(const unsigned char *input, unsigned char *output, | |||
103 | c2l(in,sin1); | 103 | c2l(in,sin1); |
104 | tin[0]=sin0; | 104 | tin[0]=sin0; |
105 | tin[1]=sin1; | 105 | tin[1]=sin1; |
106 | des_encrypt((DES_LONG *)tin,schedule,DES_DECRYPT); | 106 | des_encrypt1((DES_LONG *)tin,schedule,DES_DECRYPT); |
107 | tout0=tin[0]^xor0; | 107 | tout0=tin[0]^xor0; |
108 | tout1=tin[1]^xor1; | 108 | tout1=tin[1]^xor1; |
109 | if (length >= 8) | 109 | if (length >= 8) |
diff --git a/src/lib/libcrypto/des/speed.c b/src/lib/libcrypto/des/speed.c index 814b86f4ae..1223edf290 100644 --- a/src/lib/libcrypto/des/speed.c +++ b/src/lib/libcrypto/des/speed.c | |||
@@ -204,7 +204,7 @@ int main(int argc, char **argv) | |||
204 | count*=2; | 204 | count*=2; |
205 | Time_F(START); | 205 | Time_F(START); |
206 | for (i=count; i; i--) | 206 | for (i=count; i; i--) |
207 | des_encrypt(data,&(sch[0]),DES_ENCRYPT); | 207 | des_encrypt1(data,&(sch[0]),DES_ENCRYPT); |
208 | d=Time_F(STOP); | 208 | d=Time_F(STOP); |
209 | } while (d < 3.0); | 209 | } while (d < 3.0); |
210 | ca=count; | 210 | ca=count; |
@@ -241,7 +241,7 @@ int main(int argc, char **argv) | |||
241 | { | 241 | { |
242 | DES_LONG data[2]; | 242 | DES_LONG data[2]; |
243 | 243 | ||
244 | des_encrypt(data,&(sch[0]),DES_ENCRYPT); | 244 | des_encrypt1(data,&(sch[0]),DES_ENCRYPT); |
245 | } | 245 | } |
246 | d=Time_F(STOP); | 246 | d=Time_F(STOP); |
247 | printf("%ld des_encrypt's in %.2f second\n",count,d); | 247 | printf("%ld des_encrypt's in %.2f second\n",count,d); |
diff --git a/src/lib/libcrypto/des/xcbc_enc.c b/src/lib/libcrypto/des/xcbc_enc.c index 51e17e6b8a..ccfede13ac 100644 --- a/src/lib/libcrypto/des/xcbc_enc.c +++ b/src/lib/libcrypto/des/xcbc_enc.c | |||
@@ -138,7 +138,7 @@ void des_xcbc_encrypt(const unsigned char *in, unsigned char *out, | |||
138 | c2l(in,tin1); | 138 | c2l(in,tin1); |
139 | tin0^=tout0^inW0; tin[0]=tin0; | 139 | tin0^=tout0^inW0; tin[0]=tin0; |
140 | tin1^=tout1^inW1; tin[1]=tin1; | 140 | tin1^=tout1^inW1; tin[1]=tin1; |
141 | des_encrypt(tin,schedule,DES_ENCRYPT); | 141 | des_encrypt1(tin,schedule,DES_ENCRYPT); |
142 | tout0=tin[0]^outW0; l2c(tout0,out); | 142 | tout0=tin[0]^outW0; l2c(tout0,out); |
143 | tout1=tin[1]^outW1; l2c(tout1,out); | 143 | tout1=tin[1]^outW1; l2c(tout1,out); |
144 | } | 144 | } |
@@ -147,7 +147,7 @@ void des_xcbc_encrypt(const unsigned char *in, unsigned char *out, | |||
147 | c2ln(in,tin0,tin1,l+8); | 147 | c2ln(in,tin0,tin1,l+8); |
148 | tin0^=tout0^inW0; tin[0]=tin0; | 148 | tin0^=tout0^inW0; tin[0]=tin0; |
149 | tin1^=tout1^inW1; tin[1]=tin1; | 149 | tin1^=tout1^inW1; tin[1]=tin1; |
150 | des_encrypt(tin,schedule,DES_ENCRYPT); | 150 | des_encrypt1(tin,schedule,DES_ENCRYPT); |
151 | tout0=tin[0]^outW0; l2c(tout0,out); | 151 | tout0=tin[0]^outW0; l2c(tout0,out); |
152 | tout1=tin[1]^outW1; l2c(tout1,out); | 152 | tout1=tin[1]^outW1; l2c(tout1,out); |
153 | } | 153 | } |
@@ -163,7 +163,7 @@ void des_xcbc_encrypt(const unsigned char *in, unsigned char *out, | |||
163 | { | 163 | { |
164 | c2l(in,tin0); tin[0]=tin0^outW0; | 164 | c2l(in,tin0); tin[0]=tin0^outW0; |
165 | c2l(in,tin1); tin[1]=tin1^outW1; | 165 | c2l(in,tin1); tin[1]=tin1^outW1; |
166 | des_encrypt(tin,schedule,DES_DECRYPT); | 166 | des_encrypt1(tin,schedule,DES_DECRYPT); |
167 | tout0=tin[0]^xor0^inW0; | 167 | tout0=tin[0]^xor0^inW0; |
168 | tout1=tin[1]^xor1^inW1; | 168 | tout1=tin[1]^xor1^inW1; |
169 | l2c(tout0,out); | 169 | l2c(tout0,out); |
@@ -175,7 +175,7 @@ void des_xcbc_encrypt(const unsigned char *in, unsigned char *out, | |||
175 | { | 175 | { |
176 | c2l(in,tin0); tin[0]=tin0^outW0; | 176 | c2l(in,tin0); tin[0]=tin0^outW0; |
177 | c2l(in,tin1); tin[1]=tin1^outW1; | 177 | c2l(in,tin1); tin[1]=tin1^outW1; |
178 | des_encrypt(tin,schedule,DES_DECRYPT); | 178 | des_encrypt1(tin,schedule,DES_DECRYPT); |
179 | tout0=tin[0]^xor0^inW0; | 179 | tout0=tin[0]^xor0^inW0; |
180 | tout1=tin[1]^xor1^inW1; | 180 | tout1=tin[1]^xor1^inW1; |
181 | l2cn(tout0,tout1,out,l+8); | 181 | l2cn(tout0,tout1,out,l+8); |
diff --git a/src/lib/libcrypto/dh/Makefile.ssl b/src/lib/libcrypto/dh/Makefile.ssl index 88d0d1748b..bf4b47ca9a 100644 --- a/src/lib/libcrypto/dh/Makefile.ssl +++ b/src/lib/libcrypto/dh/Makefile.ssl | |||
@@ -39,7 +39,8 @@ all: lib | |||
39 | 39 | ||
40 | lib: $(LIBOBJ) | 40 | lib: $(LIBOBJ) |
41 | $(AR) $(LIB) $(LIBOBJ) | 41 | $(AR) $(LIB) $(LIBOBJ) |
42 | $(RANLIB) $(LIB) | 42 | @echo You may get an error following this line. Please ignore. |
43 | - $(RANLIB) $(LIB) | ||
43 | @touch lib | 44 | @touch lib |
44 | 45 | ||
45 | files: | 46 | files: |
diff --git a/src/lib/libcrypto/dh/dh_key.c b/src/lib/libcrypto/dh/dh_key.c index 6915d79dcc..22b087b778 100644 --- a/src/lib/libcrypto/dh/dh_key.c +++ b/src/lib/libcrypto/dh/dh_key.c | |||
@@ -100,7 +100,6 @@ DH_METHOD *DH_OpenSSL(void) | |||
100 | static int generate_key(DH *dh) | 100 | static int generate_key(DH *dh) |
101 | { | 101 | { |
102 | int ok=0; | 102 | int ok=0; |
103 | unsigned int i; | ||
104 | BN_CTX ctx; | 103 | BN_CTX ctx; |
105 | BN_MONT_CTX *mont; | 104 | BN_MONT_CTX *mont; |
106 | BIGNUM *pub_key=NULL,*priv_key=NULL; | 105 | BIGNUM *pub_key=NULL,*priv_key=NULL; |
@@ -109,15 +108,11 @@ static int generate_key(DH *dh) | |||
109 | 108 | ||
110 | if (dh->priv_key == NULL) | 109 | if (dh->priv_key == NULL) |
111 | { | 110 | { |
112 | i=dh->length; | ||
113 | if (i == 0) | ||
114 | { | ||
115 | /* Make the number p-1 bits long */ | ||
116 | i=BN_num_bits(dh->p)-1; | ||
117 | } | ||
118 | priv_key=BN_new(); | 111 | priv_key=BN_new(); |
119 | if (priv_key == NULL) goto err; | 112 | if (priv_key == NULL) goto err; |
120 | if (!BN_rand(priv_key,i,0,0)) goto err; | 113 | do |
114 | if (!BN_rand_range(priv_key, dh->p)) goto err; | ||
115 | while (BN_is_zero(priv_key)); | ||
121 | } | 116 | } |
122 | else | 117 | else |
123 | priv_key=dh->priv_key; | 118 | priv_key=dh->priv_key; |
diff --git a/src/lib/libcrypto/dh/dh_lib.c b/src/lib/libcrypto/dh/dh_lib.c index 66803b5565..96f118c153 100644 --- a/src/lib/libcrypto/dh/dh_lib.c +++ b/src/lib/libcrypto/dh/dh_lib.c | |||
@@ -168,13 +168,13 @@ DH *DH_new_method(ENGINE *engine) | |||
168 | ret->method_mont_p=NULL; | 168 | ret->method_mont_p=NULL; |
169 | ret->references = 1; | 169 | ret->references = 1; |
170 | ret->flags=meth->flags; | 170 | ret->flags=meth->flags; |
171 | CRYPTO_new_ex_data(dh_meth,ret,&ret->ex_data); | ||
171 | if ((meth->init != NULL) && !meth->init(ret)) | 172 | if ((meth->init != NULL) && !meth->init(ret)) |
172 | { | 173 | { |
174 | CRYPTO_free_ex_data(dh_meth,ret,&ret->ex_data); | ||
173 | OPENSSL_free(ret); | 175 | OPENSSL_free(ret); |
174 | ret=NULL; | 176 | ret=NULL; |
175 | } | 177 | } |
176 | else | ||
177 | CRYPTO_new_ex_data(dh_meth,ret,&ret->ex_data); | ||
178 | return(ret); | 178 | return(ret); |
179 | } | 179 | } |
180 | 180 | ||
@@ -196,12 +196,12 @@ void DH_free(DH *r) | |||
196 | } | 196 | } |
197 | #endif | 197 | #endif |
198 | 198 | ||
199 | CRYPTO_free_ex_data(dh_meth, r, &r->ex_data); | ||
200 | |||
201 | meth = ENGINE_get_DH(r->engine); | 199 | meth = ENGINE_get_DH(r->engine); |
202 | if(meth->finish) meth->finish(r); | 200 | if(meth->finish) meth->finish(r); |
203 | ENGINE_finish(r->engine); | 201 | ENGINE_finish(r->engine); |
204 | 202 | ||
203 | CRYPTO_free_ex_data(dh_meth, r, &r->ex_data); | ||
204 | |||
205 | if (r->p != NULL) BN_clear_free(r->p); | 205 | if (r->p != NULL) BN_clear_free(r->p); |
206 | if (r->g != NULL) BN_clear_free(r->g); | 206 | if (r->g != NULL) BN_clear_free(r->g); |
207 | if (r->q != NULL) BN_clear_free(r->q); | 207 | if (r->q != NULL) BN_clear_free(r->q); |
diff --git a/src/lib/libcrypto/doc/RAND_load_file.pod b/src/lib/libcrypto/doc/RAND_load_file.pod index 8dd700ca3d..d8c134e621 100644 --- a/src/lib/libcrypto/doc/RAND_load_file.pod +++ b/src/lib/libcrypto/doc/RAND_load_file.pod | |||
@@ -8,7 +8,7 @@ RAND_load_file, RAND_write_file, RAND_file_name - PRNG seed file | |||
8 | 8 | ||
9 | #include <openssl/rand.h> | 9 | #include <openssl/rand.h> |
10 | 10 | ||
11 | const char *RAND_file_name(char *buf, int num); | 11 | const char *RAND_file_name(char *buf, size_t num); |
12 | 12 | ||
13 | int RAND_load_file(const char *filename, long max_bytes); | 13 | int RAND_load_file(const char *filename, long max_bytes); |
14 | 14 | ||
diff --git a/src/lib/libcrypto/doc/bn.pod b/src/lib/libcrypto/doc/bn.pod index 1504a1c92d..d183028d61 100644 --- a/src/lib/libcrypto/doc/bn.pod +++ b/src/lib/libcrypto/doc/bn.pod | |||
@@ -60,6 +60,7 @@ bn - multiprecision integer arithmetics | |||
60 | 60 | ||
61 | int BN_rand(BIGNUM *rnd, int bits, int top, int bottom); | 61 | int BN_rand(BIGNUM *rnd, int bits, int top, int bottom); |
62 | int BN_pseudo_rand(BIGNUM *rnd, int bits, int top, int bottom); | 62 | int BN_pseudo_rand(BIGNUM *rnd, int bits, int top, int bottom); |
63 | int BN_rand_range(BIGNUM *rnd, BIGNUM *range); | ||
63 | 64 | ||
64 | BIGNUM *BN_generate_prime(BIGNUM *ret, int bits,int safe, BIGNUM *add, | 65 | BIGNUM *BN_generate_prime(BIGNUM *ret, int bits,int safe, BIGNUM *add, |
65 | BIGNUM *rem, void (*callback)(int, int, void *), void *cb_arg); | 66 | BIGNUM *rem, void (*callback)(int, int, void *), void *cb_arg); |
diff --git a/src/lib/libcrypto/doc/evp.pod b/src/lib/libcrypto/doc/evp.pod index f089dd49a2..edf47dbde6 100644 --- a/src/lib/libcrypto/doc/evp.pod +++ b/src/lib/libcrypto/doc/evp.pod | |||
@@ -10,7 +10,7 @@ evp - high-level cryptographic functions | |||
10 | 10 | ||
11 | =head1 DESCRIPTION | 11 | =head1 DESCRIPTION |
12 | 12 | ||
13 | The EVP library provided a high-level interface to cryptographic | 13 | The EVP library provides a high-level interface to cryptographic |
14 | functions. | 14 | functions. |
15 | 15 | ||
16 | B<EVP_Seal>I<...> and B<EVP_Open>I<...> provide public key encryption | 16 | B<EVP_Seal>I<...> and B<EVP_Open>I<...> provide public key encryption |
diff --git a/src/lib/libcrypto/dsa/Makefile.ssl b/src/lib/libcrypto/dsa/Makefile.ssl index dac582be00..d88f596364 100644 --- a/src/lib/libcrypto/dsa/Makefile.ssl +++ b/src/lib/libcrypto/dsa/Makefile.ssl | |||
@@ -41,7 +41,8 @@ all: lib | |||
41 | 41 | ||
42 | lib: $(LIBOBJ) | 42 | lib: $(LIBOBJ) |
43 | $(AR) $(LIB) $(LIBOBJ) | 43 | $(AR) $(LIB) $(LIBOBJ) |
44 | $(RANLIB) $(LIB) | 44 | @echo You may get an error following this line. Please ignore. |
45 | - $(RANLIB) $(LIB) | ||
45 | @touch lib | 46 | @touch lib |
46 | 47 | ||
47 | files: | 48 | files: |
diff --git a/src/lib/libcrypto/dso/Makefile.ssl b/src/lib/libcrypto/dso/Makefile.ssl index a37f547482..48b36c8330 100644 --- a/src/lib/libcrypto/dso/Makefile.ssl +++ b/src/lib/libcrypto/dso/Makefile.ssl | |||
@@ -41,7 +41,8 @@ all: lib | |||
41 | 41 | ||
42 | lib: $(LIBOBJ) | 42 | lib: $(LIBOBJ) |
43 | $(AR) $(LIB) $(LIBOBJ) | 43 | $(AR) $(LIB) $(LIBOBJ) |
44 | $(RANLIB) $(LIB) | 44 | @echo You may get an error following this line. Please ignore. |
45 | - $(RANLIB) $(LIB) | ||
45 | @touch lib | 46 | @touch lib |
46 | 47 | ||
47 | files: | 48 | files: |
diff --git a/src/lib/libcrypto/dso/dso_dl.c b/src/lib/libcrypto/dso/dso_dl.c index 69810fc3bb..455bd66ecf 100644 --- a/src/lib/libcrypto/dso/dso_dl.c +++ b/src/lib/libcrypto/dso/dso_dl.c | |||
@@ -82,7 +82,7 @@ static int dl_unbind_func(DSO *dso, char *symname, DSO_FUNC_TYPE symptr); | |||
82 | static int dl_init(DSO *dso); | 82 | static int dl_init(DSO *dso); |
83 | static int dl_finish(DSO *dso); | 83 | static int dl_finish(DSO *dso); |
84 | #endif | 84 | #endif |
85 | static int dl_ctrl(DSO *dso, int cmd, long larg, void *parg); | 85 | static long dl_ctrl(DSO *dso, int cmd, long larg, void *parg); |
86 | 86 | ||
87 | static DSO_METHOD dso_meth_dl = { | 87 | static DSO_METHOD dso_meth_dl = { |
88 | "OpenSSL 'dl' shared library method", | 88 | "OpenSSL 'dl' shared library method", |
@@ -111,6 +111,11 @@ DSO_METHOD *DSO_METHOD_dl(void) | |||
111 | * type so the cast is safe. | 111 | * type so the cast is safe. |
112 | */ | 112 | */ |
113 | 113 | ||
114 | #if defined(__hpux) | ||
115 | static const char extension[] = ".sl"; | ||
116 | #else | ||
117 | static const char extension[] = ".so"; | ||
118 | #endif | ||
114 | static int dl_load(DSO *dso, const char *filename) | 119 | static int dl_load(DSO *dso, const char *filename) |
115 | { | 120 | { |
116 | shl_t ptr; | 121 | shl_t ptr; |
@@ -118,12 +123,12 @@ static int dl_load(DSO *dso, const char *filename) | |||
118 | int len; | 123 | int len; |
119 | 124 | ||
120 | /* The same comment as in dlfcn_load applies here. bleurgh. */ | 125 | /* The same comment as in dlfcn_load applies here. bleurgh. */ |
121 | len = strlen(filename); | 126 | len = strlen(filename) + strlen(extension); |
122 | if((dso->flags & DSO_FLAG_NAME_TRANSLATION) && | 127 | if((dso->flags & DSO_FLAG_NAME_TRANSLATION) && |
123 | (len + 6 < DSO_MAX_TRANSLATED_SIZE) && | 128 | (len + 3 < DSO_MAX_TRANSLATED_SIZE) && |
124 | (strstr(filename, "/") == NULL)) | 129 | (strstr(filename, "/") == NULL)) |
125 | { | 130 | { |
126 | sprintf(translated, "lib%s.so", filename); | 131 | sprintf(translated, "lib%s%s", filename, extension); |
127 | ptr = shl_load(translated, BIND_IMMEDIATE, NULL); | 132 | ptr = shl_load(translated, BIND_IMMEDIATE, NULL); |
128 | } | 133 | } |
129 | else | 134 | else |
@@ -187,7 +192,7 @@ static void *dl_bind_var(DSO *dso, const char *symname) | |||
187 | DSOerr(DSO_F_DL_BIND_VAR,DSO_R_NULL_HANDLE); | 192 | DSOerr(DSO_F_DL_BIND_VAR,DSO_R_NULL_HANDLE); |
188 | return(NULL); | 193 | return(NULL); |
189 | } | 194 | } |
190 | if (shl_findsym(ptr, symname, TYPE_UNDEFINED, &sym) < 0) | 195 | if (shl_findsym(&ptr, symname, TYPE_UNDEFINED, &sym) < 0) |
191 | { | 196 | { |
192 | DSOerr(DSO_F_DL_BIND_VAR,DSO_R_SYM_FAILURE); | 197 | DSOerr(DSO_F_DL_BIND_VAR,DSO_R_SYM_FAILURE); |
193 | return(NULL); | 198 | return(NULL); |
@@ -216,7 +221,7 @@ static DSO_FUNC_TYPE dl_bind_func(DSO *dso, const char *symname) | |||
216 | DSOerr(DSO_F_DL_BIND_FUNC,DSO_R_NULL_HANDLE); | 221 | DSOerr(DSO_F_DL_BIND_FUNC,DSO_R_NULL_HANDLE); |
217 | return(NULL); | 222 | return(NULL); |
218 | } | 223 | } |
219 | if (shl_findsym(ptr, symname, TYPE_UNDEFINED, &sym) < 0) | 224 | if (shl_findsym(&ptr, symname, TYPE_UNDEFINED, &sym) < 0) |
220 | { | 225 | { |
221 | DSOerr(DSO_F_DL_BIND_FUNC,DSO_R_SYM_FAILURE); | 226 | DSOerr(DSO_F_DL_BIND_FUNC,DSO_R_SYM_FAILURE); |
222 | return(NULL); | 227 | return(NULL); |
@@ -224,7 +229,7 @@ static DSO_FUNC_TYPE dl_bind_func(DSO *dso, const char *symname) | |||
224 | return((DSO_FUNC_TYPE)sym); | 229 | return((DSO_FUNC_TYPE)sym); |
225 | } | 230 | } |
226 | 231 | ||
227 | static int dl_ctrl(DSO *dso, int cmd, long larg, void *parg) | 232 | static long dl_ctrl(DSO *dso, int cmd, long larg, void *parg) |
228 | { | 233 | { |
229 | if(dso == NULL) | 234 | if(dso == NULL) |
230 | { | 235 | { |
@@ -236,10 +241,10 @@ static int dl_ctrl(DSO *dso, int cmd, long larg, void *parg) | |||
236 | case DSO_CTRL_GET_FLAGS: | 241 | case DSO_CTRL_GET_FLAGS: |
237 | return dso->flags; | 242 | return dso->flags; |
238 | case DSO_CTRL_SET_FLAGS: | 243 | case DSO_CTRL_SET_FLAGS: |
239 | dso->flags = (int)larg; | 244 | dso->flags = larg; |
240 | return(0); | 245 | return(0); |
241 | case DSO_CTRL_OR_FLAGS: | 246 | case DSO_CTRL_OR_FLAGS: |
242 | dso->flags |= (int)larg; | 247 | dso->flags |= larg; |
243 | return(0); | 248 | return(0); |
244 | default: | 249 | default: |
245 | break; | 250 | break; |
diff --git a/src/lib/libcrypto/dso/dso_vms.c b/src/lib/libcrypto/dso/dso_vms.c index 8ff7090129..ab48b63eb7 100644 --- a/src/lib/libcrypto/dso/dso_vms.c +++ b/src/lib/libcrypto/dso/dso_vms.c | |||
@@ -62,7 +62,6 @@ | |||
62 | #ifdef VMS | 62 | #ifdef VMS |
63 | #pragma message disable DOLLARID | 63 | #pragma message disable DOLLARID |
64 | #include <lib$routines.h> | 64 | #include <lib$routines.h> |
65 | #include <libfisdef.h> | ||
66 | #include <stsdef.h> | 65 | #include <stsdef.h> |
67 | #include <descrip.h> | 66 | #include <descrip.h> |
68 | #include <starlet.h> | 67 | #include <starlet.h> |
@@ -260,7 +259,8 @@ void vms_bind_sym(DSO *dso, const char *symname, void **sym) | |||
260 | { | 259 | { |
261 | DSO_VMS_INTERNAL *ptr; | 260 | DSO_VMS_INTERNAL *ptr; |
262 | int status; | 261 | int status; |
263 | int flags = LIB$M_FIS_MIXEDCASE; | 262 | int flags = (1<<4); /* LIB$M_FIS_MIXEDCASE, but this symbol isn't |
263 | defined in VMS older than 7.0 or so */ | ||
264 | struct dsc$descriptor_s symname_dsc; | 264 | struct dsc$descriptor_s symname_dsc; |
265 | *sym = NULL; | 265 | *sym = NULL; |
266 | 266 | ||
diff --git a/src/lib/libcrypto/ebcdic.c b/src/lib/libcrypto/ebcdic.c index 31397b2add..91a7a8bcb4 100644 --- a/src/lib/libcrypto/ebcdic.c +++ b/src/lib/libcrypto/ebcdic.c | |||
@@ -211,7 +211,7 @@ ascii2ebcdic(void *dest, const void *srce, size_t count) | |||
211 | } | 211 | } |
212 | 212 | ||
213 | #else /*CHARSET_EBCDIC*/ | 213 | #else /*CHARSET_EBCDIC*/ |
214 | #ifdef PEDANTIC | 214 | #if defined(PEDANTIC) || defined(VMS) || defined(__VMS) |
215 | static void *dummy=&dummy; | 215 | static void *dummy=&dummy; |
216 | #endif | 216 | #endif |
217 | #endif | 217 | #endif |
diff --git a/src/lib/libcrypto/engine/engine_lib.c b/src/lib/libcrypto/engine/engine_lib.c index 1df07af03a..d6e9109f6e 100644 --- a/src/lib/libcrypto/engine/engine_lib.c +++ b/src/lib/libcrypto/engine/engine_lib.c | |||
@@ -230,17 +230,18 @@ EVP_PKEY *ENGINE_load_private_key(ENGINE *e, const char *key_id, | |||
230 | CRYPTO_w_lock(CRYPTO_LOCK_ENGINE); | 230 | CRYPTO_w_lock(CRYPTO_LOCK_ENGINE); |
231 | if(e->funct_ref == 0) | 231 | if(e->funct_ref == 0) |
232 | { | 232 | { |
233 | CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE); | ||
233 | ENGINEerr(ENGINE_F_ENGINE_LOAD_PRIVATE_KEY, | 234 | ENGINEerr(ENGINE_F_ENGINE_LOAD_PRIVATE_KEY, |
234 | ENGINE_R_NOT_INITIALISED); | 235 | ENGINE_R_NOT_INITIALISED); |
235 | return 0; | 236 | return 0; |
236 | } | 237 | } |
238 | CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE); | ||
237 | if (!e->load_privkey) | 239 | if (!e->load_privkey) |
238 | { | 240 | { |
239 | ENGINEerr(ENGINE_F_ENGINE_LOAD_PRIVATE_KEY, | 241 | ENGINEerr(ENGINE_F_ENGINE_LOAD_PRIVATE_KEY, |
240 | ENGINE_R_NO_LOAD_FUNCTION); | 242 | ENGINE_R_NO_LOAD_FUNCTION); |
241 | return 0; | 243 | return 0; |
242 | } | 244 | } |
243 | CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE); | ||
244 | pkey = e->load_privkey(key_id, passphrase); | 245 | pkey = e->load_privkey(key_id, passphrase); |
245 | if (!pkey) | 246 | if (!pkey) |
246 | { | 247 | { |
@@ -265,17 +266,18 @@ EVP_PKEY *ENGINE_load_public_key(ENGINE *e, const char *key_id, | |||
265 | CRYPTO_w_lock(CRYPTO_LOCK_ENGINE); | 266 | CRYPTO_w_lock(CRYPTO_LOCK_ENGINE); |
266 | if(e->funct_ref == 0) | 267 | if(e->funct_ref == 0) |
267 | { | 268 | { |
269 | CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE); | ||
268 | ENGINEerr(ENGINE_F_ENGINE_LOAD_PUBLIC_KEY, | 270 | ENGINEerr(ENGINE_F_ENGINE_LOAD_PUBLIC_KEY, |
269 | ENGINE_R_NOT_INITIALISED); | 271 | ENGINE_R_NOT_INITIALISED); |
270 | return 0; | 272 | return 0; |
271 | } | 273 | } |
274 | CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE); | ||
272 | if (!e->load_pubkey) | 275 | if (!e->load_pubkey) |
273 | { | 276 | { |
274 | ENGINEerr(ENGINE_F_ENGINE_LOAD_PUBLIC_KEY, | 277 | ENGINEerr(ENGINE_F_ENGINE_LOAD_PUBLIC_KEY, |
275 | ENGINE_R_NO_LOAD_FUNCTION); | 278 | ENGINE_R_NO_LOAD_FUNCTION); |
276 | return 0; | 279 | return 0; |
277 | } | 280 | } |
278 | CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE); | ||
279 | pkey = e->load_pubkey(key_id, passphrase); | 281 | pkey = e->load_pubkey(key_id, passphrase); |
280 | if (!pkey) | 282 | if (!pkey) |
281 | { | 283 | { |
@@ -286,8 +288,6 @@ EVP_PKEY *ENGINE_load_public_key(ENGINE *e, const char *key_id, | |||
286 | return pkey; | 288 | return pkey; |
287 | } | 289 | } |
288 | 290 | ||
289 | /* Initialise a engine type for use (or up its functional reference count | ||
290 | * if it's already in use). */ | ||
291 | int ENGINE_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)()) | 291 | int ENGINE_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)()) |
292 | { | 292 | { |
293 | if(e == NULL) | 293 | if(e == NULL) |
@@ -298,15 +298,16 @@ int ENGINE_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)()) | |||
298 | CRYPTO_w_lock(CRYPTO_LOCK_ENGINE); | 298 | CRYPTO_w_lock(CRYPTO_LOCK_ENGINE); |
299 | if(e->struct_ref == 0) | 299 | if(e->struct_ref == 0) |
300 | { | 300 | { |
301 | CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE); | ||
301 | ENGINEerr(ENGINE_F_ENGINE_CTRL,ENGINE_R_NO_REFERENCE); | 302 | ENGINEerr(ENGINE_F_ENGINE_CTRL,ENGINE_R_NO_REFERENCE); |
302 | return 0; | 303 | return 0; |
303 | } | 304 | } |
305 | CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE); | ||
304 | if (!e->ctrl) | 306 | if (!e->ctrl) |
305 | { | 307 | { |
306 | ENGINEerr(ENGINE_F_ENGINE_CTRL,ENGINE_R_NO_CONTROL_FUNCTION); | 308 | ENGINEerr(ENGINE_F_ENGINE_CTRL,ENGINE_R_NO_CONTROL_FUNCTION); |
307 | return 0; | 309 | return 0; |
308 | } | 310 | } |
309 | CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE); | ||
310 | return e->ctrl(cmd, i, p, f); | 311 | return e->ctrl(cmd, i, p, f); |
311 | } | 312 | } |
312 | 313 | ||
diff --git a/src/lib/libcrypto/err/Makefile.ssl b/src/lib/libcrypto/err/Makefile.ssl index cf94f406e4..58218d1cea 100644 --- a/src/lib/libcrypto/err/Makefile.ssl +++ b/src/lib/libcrypto/err/Makefile.ssl | |||
@@ -39,7 +39,8 @@ all: lib | |||
39 | 39 | ||
40 | lib: $(LIBOBJ) | 40 | lib: $(LIBOBJ) |
41 | $(AR) $(LIB) $(LIBOBJ) | 41 | $(AR) $(LIB) $(LIBOBJ) |
42 | $(RANLIB) $(LIB) | 42 | @echo You may get an error following this line. Please ignore. |
43 | - $(RANLIB) $(LIB) | ||
43 | @touch lib | 44 | @touch lib |
44 | 45 | ||
45 | files: | 46 | files: |
diff --git a/src/lib/libcrypto/err/err.c b/src/lib/libcrypto/err/err.c index 99272e437c..839f4ab81a 100644 --- a/src/lib/libcrypto/err/err.c +++ b/src/lib/libcrypto/err/err.c | |||
@@ -389,20 +389,18 @@ void ERR_put_error(int lib, int func, int reason, const char *file, | |||
389 | 389 | ||
390 | void ERR_clear_error(void) | 390 | void ERR_clear_error(void) |
391 | { | 391 | { |
392 | int i; | ||
392 | ERR_STATE *es; | 393 | ERR_STATE *es; |
393 | 394 | ||
394 | es=ERR_get_state(); | 395 | es=ERR_get_state(); |
395 | 396 | ||
396 | #if 0 | ||
397 | /* hmm... is this needed */ | ||
398 | for (i=0; i<ERR_NUM_ERRORS; i++) | 397 | for (i=0; i<ERR_NUM_ERRORS; i++) |
399 | { | 398 | { |
400 | es->err_buffer[i]=0; | 399 | es->err_buffer[i]=0; |
400 | err_clear_data(es,i); | ||
401 | es->err_file[i]=NULL; | 401 | es->err_file[i]=NULL; |
402 | es->err_line[i]= -1; | 402 | es->err_line[i]= -1; |
403 | err_clear_data(es,i); | ||
404 | } | 403 | } |
405 | #endif | ||
406 | es->top=es->bottom=0; | 404 | es->top=es->bottom=0; |
407 | } | 405 | } |
408 | 406 | ||
@@ -464,7 +462,14 @@ static unsigned long get_error_values(int inc, const char **file, int *line, | |||
464 | } | 462 | } |
465 | } | 463 | } |
466 | 464 | ||
467 | if (data != NULL) | 465 | if (data == NULL) |
466 | { | ||
467 | if (inc) | ||
468 | { | ||
469 | err_clear_data(es, i); | ||
470 | } | ||
471 | } | ||
472 | else | ||
468 | { | 473 | { |
469 | if (es->err_data[i] == NULL) | 474 | if (es->err_data[i] == NULL) |
470 | { | 475 | { |
@@ -749,8 +754,9 @@ void ERR_set_error_data(char *data, int flags) | |||
749 | if (i == 0) | 754 | if (i == 0) |
750 | i=ERR_NUM_ERRORS-1; | 755 | i=ERR_NUM_ERRORS-1; |
751 | 756 | ||
757 | err_clear_data(es,i); | ||
752 | es->err_data[i]=data; | 758 | es->err_data[i]=data; |
753 | es->err_data_flags[es->top]=flags; | 759 | es->err_data_flags[i]=flags; |
754 | } | 760 | } |
755 | 761 | ||
756 | void ERR_add_error_data(int num, ...) | 762 | void ERR_add_error_data(int num, ...) |
@@ -759,7 +765,7 @@ void ERR_add_error_data(int num, ...) | |||
759 | int i,n,s; | 765 | int i,n,s; |
760 | char *str,*p,*a; | 766 | char *str,*p,*a; |
761 | 767 | ||
762 | s=64; | 768 | s=80; |
763 | str=OPENSSL_malloc(s+1); | 769 | str=OPENSSL_malloc(s+1); |
764 | if (str == NULL) return; | 770 | if (str == NULL) return; |
765 | str[0]='\0'; | 771 | str[0]='\0'; |
diff --git a/src/lib/libcrypto/evp/Makefile.ssl b/src/lib/libcrypto/evp/Makefile.ssl index ad39fcc9e7..624168031d 100644 --- a/src/lib/libcrypto/evp/Makefile.ssl +++ b/src/lib/libcrypto/evp/Makefile.ssl | |||
@@ -58,7 +58,8 @@ all: lib | |||
58 | 58 | ||
59 | lib: $(LIBOBJ) | 59 | lib: $(LIBOBJ) |
60 | $(AR) $(LIB) $(LIBOBJ) | 60 | $(AR) $(LIB) $(LIBOBJ) |
61 | $(RANLIB) $(LIB) | 61 | @echo You may get an error following this line. Please ignore. |
62 | - $(RANLIB) $(LIB) | ||
62 | @touch lib | 63 | @touch lib |
63 | 64 | ||
64 | files: | 65 | files: |
diff --git a/src/lib/libcrypto/evp/evp.h b/src/lib/libcrypto/evp/evp.h index 62350dfd69..76d417b44a 100644 --- a/src/lib/libcrypto/evp/evp.h +++ b/src/lib/libcrypto/evp/evp.h | |||
@@ -462,12 +462,20 @@ typedef int (EVP_PBE_KEYGEN)(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, | |||
462 | ASN1_TYPE *param, EVP_CIPHER *cipher, | 462 | ASN1_TYPE *param, EVP_CIPHER *cipher, |
463 | EVP_MD *md, int en_de); | 463 | EVP_MD *md, int en_de); |
464 | 464 | ||
465 | #ifndef NO_RSA | ||
465 | #define EVP_PKEY_assign_RSA(pkey,rsa) EVP_PKEY_assign((pkey),EVP_PKEY_RSA,\ | 466 | #define EVP_PKEY_assign_RSA(pkey,rsa) EVP_PKEY_assign((pkey),EVP_PKEY_RSA,\ |
466 | (char *)(rsa)) | 467 | (char *)(rsa)) |
468 | #endif | ||
469 | |||
470 | #ifndef NO_DSA | ||
467 | #define EVP_PKEY_assign_DSA(pkey,dsa) EVP_PKEY_assign((pkey),EVP_PKEY_DSA,\ | 471 | #define EVP_PKEY_assign_DSA(pkey,dsa) EVP_PKEY_assign((pkey),EVP_PKEY_DSA,\ |
468 | (char *)(dsa)) | 472 | (char *)(dsa)) |
473 | #endif | ||
474 | |||
475 | #ifndef NO_DH | ||
469 | #define EVP_PKEY_assign_DH(pkey,dh) EVP_PKEY_assign((pkey),EVP_PKEY_DH,\ | 476 | #define EVP_PKEY_assign_DH(pkey,dh) EVP_PKEY_assign((pkey),EVP_PKEY_DH,\ |
470 | (char *)(dh)) | 477 | (char *)(dh)) |
478 | #endif | ||
471 | 479 | ||
472 | /* Add some extra combinations */ | 480 | /* Add some extra combinations */ |
473 | #define EVP_get_digestbynid(a) EVP_get_digestbyname(OBJ_nid2sn(a)) | 481 | #define EVP_get_digestbynid(a) EVP_get_digestbyname(OBJ_nid2sn(a)) |
@@ -611,17 +619,29 @@ void BIO_set_cipher(BIO *b,const EVP_CIPHER *c,unsigned char *k, | |||
611 | #endif | 619 | #endif |
612 | 620 | ||
613 | EVP_MD *EVP_md_null(void); | 621 | EVP_MD *EVP_md_null(void); |
622 | #ifndef NO_MD2 | ||
614 | EVP_MD *EVP_md2(void); | 623 | EVP_MD *EVP_md2(void); |
624 | #endif | ||
625 | #ifndef NO_MD4 | ||
615 | EVP_MD *EVP_md4(void); | 626 | EVP_MD *EVP_md4(void); |
627 | #endif | ||
628 | #ifndef NO_MD5 | ||
616 | EVP_MD *EVP_md5(void); | 629 | EVP_MD *EVP_md5(void); |
630 | #endif | ||
631 | #ifndef NO_SHA | ||
617 | EVP_MD *EVP_sha(void); | 632 | EVP_MD *EVP_sha(void); |
618 | EVP_MD *EVP_sha1(void); | 633 | EVP_MD *EVP_sha1(void); |
619 | EVP_MD *EVP_dss(void); | 634 | EVP_MD *EVP_dss(void); |
620 | EVP_MD *EVP_dss1(void); | 635 | EVP_MD *EVP_dss1(void); |
636 | #endif | ||
637 | #ifndef NO_MDC2 | ||
621 | EVP_MD *EVP_mdc2(void); | 638 | EVP_MD *EVP_mdc2(void); |
639 | #endif | ||
640 | #ifndef NO_RIPEMD | ||
622 | EVP_MD *EVP_ripemd160(void); | 641 | EVP_MD *EVP_ripemd160(void); |
623 | 642 | #endif | |
624 | EVP_CIPHER *EVP_enc_null(void); /* does nothing :-) */ | 643 | EVP_CIPHER *EVP_enc_null(void); /* does nothing :-) */ |
644 | #ifndef NO_DES | ||
625 | EVP_CIPHER *EVP_des_ecb(void); | 645 | EVP_CIPHER *EVP_des_ecb(void); |
626 | EVP_CIPHER *EVP_des_ede(void); | 646 | EVP_CIPHER *EVP_des_ede(void); |
627 | EVP_CIPHER *EVP_des_ede3(void); | 647 | EVP_CIPHER *EVP_des_ede3(void); |
@@ -635,31 +655,43 @@ EVP_CIPHER *EVP_des_cbc(void); | |||
635 | EVP_CIPHER *EVP_des_ede_cbc(void); | 655 | EVP_CIPHER *EVP_des_ede_cbc(void); |
636 | EVP_CIPHER *EVP_des_ede3_cbc(void); | 656 | EVP_CIPHER *EVP_des_ede3_cbc(void); |
637 | EVP_CIPHER *EVP_desx_cbc(void); | 657 | EVP_CIPHER *EVP_desx_cbc(void); |
658 | #endif | ||
659 | #ifndef NO_RC4 | ||
638 | EVP_CIPHER *EVP_rc4(void); | 660 | EVP_CIPHER *EVP_rc4(void); |
639 | EVP_CIPHER *EVP_rc4_40(void); | 661 | EVP_CIPHER *EVP_rc4_40(void); |
662 | #endif | ||
663 | #ifndef NO_IDEA | ||
640 | EVP_CIPHER *EVP_idea_ecb(void); | 664 | EVP_CIPHER *EVP_idea_ecb(void); |
641 | EVP_CIPHER *EVP_idea_cfb(void); | 665 | EVP_CIPHER *EVP_idea_cfb(void); |
642 | EVP_CIPHER *EVP_idea_ofb(void); | 666 | EVP_CIPHER *EVP_idea_ofb(void); |
643 | EVP_CIPHER *EVP_idea_cbc(void); | 667 | EVP_CIPHER *EVP_idea_cbc(void); |
668 | #endif | ||
669 | #ifndef NO_RC2 | ||
644 | EVP_CIPHER *EVP_rc2_ecb(void); | 670 | EVP_CIPHER *EVP_rc2_ecb(void); |
645 | EVP_CIPHER *EVP_rc2_cbc(void); | 671 | EVP_CIPHER *EVP_rc2_cbc(void); |
646 | EVP_CIPHER *EVP_rc2_40_cbc(void); | 672 | EVP_CIPHER *EVP_rc2_40_cbc(void); |
647 | EVP_CIPHER *EVP_rc2_64_cbc(void); | 673 | EVP_CIPHER *EVP_rc2_64_cbc(void); |
648 | EVP_CIPHER *EVP_rc2_cfb(void); | 674 | EVP_CIPHER *EVP_rc2_cfb(void); |
649 | EVP_CIPHER *EVP_rc2_ofb(void); | 675 | EVP_CIPHER *EVP_rc2_ofb(void); |
676 | #endif | ||
677 | #ifndef NO_BF | ||
650 | EVP_CIPHER *EVP_bf_ecb(void); | 678 | EVP_CIPHER *EVP_bf_ecb(void); |
651 | EVP_CIPHER *EVP_bf_cbc(void); | 679 | EVP_CIPHER *EVP_bf_cbc(void); |
652 | EVP_CIPHER *EVP_bf_cfb(void); | 680 | EVP_CIPHER *EVP_bf_cfb(void); |
653 | EVP_CIPHER *EVP_bf_ofb(void); | 681 | EVP_CIPHER *EVP_bf_ofb(void); |
682 | #endif | ||
683 | #ifndef NO_CAST | ||
654 | EVP_CIPHER *EVP_cast5_ecb(void); | 684 | EVP_CIPHER *EVP_cast5_ecb(void); |
655 | EVP_CIPHER *EVP_cast5_cbc(void); | 685 | EVP_CIPHER *EVP_cast5_cbc(void); |
656 | EVP_CIPHER *EVP_cast5_cfb(void); | 686 | EVP_CIPHER *EVP_cast5_cfb(void); |
657 | EVP_CIPHER *EVP_cast5_ofb(void); | 687 | EVP_CIPHER *EVP_cast5_ofb(void); |
688 | #endif | ||
689 | #ifndef NO_RC5 | ||
658 | EVP_CIPHER *EVP_rc5_32_12_16_cbc(void); | 690 | EVP_CIPHER *EVP_rc5_32_12_16_cbc(void); |
659 | EVP_CIPHER *EVP_rc5_32_12_16_ecb(void); | 691 | EVP_CIPHER *EVP_rc5_32_12_16_ecb(void); |
660 | EVP_CIPHER *EVP_rc5_32_12_16_cfb(void); | 692 | EVP_CIPHER *EVP_rc5_32_12_16_cfb(void); |
661 | EVP_CIPHER *EVP_rc5_32_12_16_ofb(void); | 693 | EVP_CIPHER *EVP_rc5_32_12_16_ofb(void); |
662 | 694 | #endif | |
663 | void OpenSSL_add_all_algorithms(void); | 695 | void OpenSSL_add_all_algorithms(void); |
664 | void OpenSSL_add_all_ciphers(void); | 696 | void OpenSSL_add_all_ciphers(void); |
665 | void OpenSSL_add_all_digests(void); | 697 | void OpenSSL_add_all_digests(void); |
diff --git a/src/lib/libcrypto/ex_data.c b/src/lib/libcrypto/ex_data.c index 1ee88da2a8..739e543d78 100644 --- a/src/lib/libcrypto/ex_data.c +++ b/src/lib/libcrypto/ex_data.c | |||
@@ -101,7 +101,7 @@ int CRYPTO_get_ex_new_index(int idx, STACK_OF(CRYPTO_EX_DATA_FUNCS) **skp, long | |||
101 | ret=idx; | 101 | ret=idx; |
102 | err: | 102 | err: |
103 | MemCheck_on(); | 103 | MemCheck_on(); |
104 | return(idx); | 104 | return(ret); |
105 | } | 105 | } |
106 | 106 | ||
107 | int CRYPTO_set_ex_data(CRYPTO_EX_DATA *ad, int idx, void *val) | 107 | int CRYPTO_set_ex_data(CRYPTO_EX_DATA *ad, int idx, void *val) |
diff --git a/src/lib/libcrypto/hmac/Makefile.ssl b/src/lib/libcrypto/hmac/Makefile.ssl index cf57311973..326339a90d 100644 --- a/src/lib/libcrypto/hmac/Makefile.ssl +++ b/src/lib/libcrypto/hmac/Makefile.ssl | |||
@@ -39,7 +39,8 @@ all: lib | |||
39 | 39 | ||
40 | lib: $(LIBOBJ) | 40 | lib: $(LIBOBJ) |
41 | $(AR) $(LIB) $(LIBOBJ) | 41 | $(AR) $(LIB) $(LIBOBJ) |
42 | $(RANLIB) $(LIB) | 42 | @echo You may get an error following this line. Please ignore. |
43 | - $(RANLIB) $(LIB) | ||
43 | @touch lib | 44 | @touch lib |
44 | 45 | ||
45 | files: | 46 | files: |
diff --git a/src/lib/libcrypto/idea/Makefile.ssl b/src/lib/libcrypto/idea/Makefile.ssl index 5b334ce921..30302e0b9f 100644 --- a/src/lib/libcrypto/idea/Makefile.ssl +++ b/src/lib/libcrypto/idea/Makefile.ssl | |||
@@ -39,7 +39,8 @@ all: lib | |||
39 | 39 | ||
40 | lib: $(LIBOBJ) | 40 | lib: $(LIBOBJ) |
41 | $(AR) $(LIB) $(LIBOBJ) | 41 | $(AR) $(LIB) $(LIBOBJ) |
42 | $(RANLIB) $(LIB) | 42 | @echo You may get an error following this line. Please ignore. |
43 | - $(RANLIB) $(LIB) | ||
43 | @touch lib | 44 | @touch lib |
44 | 45 | ||
45 | files: | 46 | files: |
diff --git a/src/lib/libcrypto/lhash/Makefile.ssl b/src/lib/libcrypto/lhash/Makefile.ssl index 6c3d442e22..79849d7d6e 100644 --- a/src/lib/libcrypto/lhash/Makefile.ssl +++ b/src/lib/libcrypto/lhash/Makefile.ssl | |||
@@ -39,7 +39,8 @@ all: lib | |||
39 | 39 | ||
40 | lib: $(LIBOBJ) | 40 | lib: $(LIBOBJ) |
41 | $(AR) $(LIB) $(LIBOBJ) | 41 | $(AR) $(LIB) $(LIBOBJ) |
42 | $(RANLIB) $(LIB) | 42 | @echo You may get an error following this line. Please ignore. |
43 | - $(RANLIB) $(LIB) | ||
43 | @touch lib | 44 | @touch lib |
44 | 45 | ||
45 | files: | 46 | files: |
diff --git a/src/lib/libcrypto/md2/Makefile.ssl b/src/lib/libcrypto/md2/Makefile.ssl index d46c73a9b9..269628d739 100644 --- a/src/lib/libcrypto/md2/Makefile.ssl +++ b/src/lib/libcrypto/md2/Makefile.ssl | |||
@@ -39,7 +39,8 @@ all: lib | |||
39 | 39 | ||
40 | lib: $(LIBOBJ) | 40 | lib: $(LIBOBJ) |
41 | $(AR) $(LIB) $(LIBOBJ) | 41 | $(AR) $(LIB) $(LIBOBJ) |
42 | $(RANLIB) $(LIB) | 42 | @echo You may get an error following this line. Please ignore. |
43 | - $(RANLIB) $(LIB) | ||
43 | @touch lib | 44 | @touch lib |
44 | 45 | ||
45 | files: | 46 | files: |
diff --git a/src/lib/libcrypto/md4/Makefile.ssl b/src/lib/libcrypto/md4/Makefile.ssl index 6ee3ca88ed..646607274e 100644 --- a/src/lib/libcrypto/md4/Makefile.ssl +++ b/src/lib/libcrypto/md4/Makefile.ssl | |||
@@ -40,7 +40,8 @@ all: lib | |||
40 | 40 | ||
41 | lib: $(LIBOBJ) | 41 | lib: $(LIBOBJ) |
42 | $(AR) $(LIB) $(LIBOBJ) | 42 | $(AR) $(LIB) $(LIBOBJ) |
43 | $(RANLIB) $(LIB) | 43 | @echo You may get an error following this line. Please ignore. |
44 | - $(RANLIB) $(LIB) | ||
44 | @touch lib | 45 | @touch lib |
45 | 46 | ||
46 | files: | 47 | files: |
diff --git a/src/lib/libcrypto/md5/Makefile.ssl b/src/lib/libcrypto/md5/Makefile.ssl index e8d0cced7f..784215579b 100644 --- a/src/lib/libcrypto/md5/Makefile.ssl +++ b/src/lib/libcrypto/md5/Makefile.ssl | |||
@@ -50,7 +50,8 @@ all: lib | |||
50 | 50 | ||
51 | lib: $(LIBOBJ) | 51 | lib: $(LIBOBJ) |
52 | $(AR) $(LIB) $(LIBOBJ) | 52 | $(AR) $(LIB) $(LIBOBJ) |
53 | $(RANLIB) $(LIB) | 53 | @echo You may get an error following this line. Please ignore. |
54 | - $(RANLIB) $(LIB) | ||
54 | @touch lib | 55 | @touch lib |
55 | 56 | ||
56 | # elf | 57 | # elf |
diff --git a/src/lib/libcrypto/mdc2/Makefile.ssl b/src/lib/libcrypto/mdc2/Makefile.ssl index da11c4edea..a9b06b02bd 100644 --- a/src/lib/libcrypto/mdc2/Makefile.ssl +++ b/src/lib/libcrypto/mdc2/Makefile.ssl | |||
@@ -39,7 +39,8 @@ all: lib | |||
39 | 39 | ||
40 | lib: $(LIBOBJ) | 40 | lib: $(LIBOBJ) |
41 | $(AR) $(LIB) $(LIBOBJ) | 41 | $(AR) $(LIB) $(LIBOBJ) |
42 | $(RANLIB) $(LIB) | 42 | @echo You may get an error following this line. Please ignore. |
43 | - $(RANLIB) $(LIB) | ||
43 | @touch lib | 44 | @touch lib |
44 | 45 | ||
45 | files: | 46 | files: |
diff --git a/src/lib/libcrypto/mem_dbg.c b/src/lib/libcrypto/mem_dbg.c index 866c53e73a..ef19d8f844 100644 --- a/src/lib/libcrypto/mem_dbg.c +++ b/src/lib/libcrypto/mem_dbg.c | |||
@@ -81,7 +81,8 @@ static int mh_mode=CRYPTO_MEM_CHECK_OFF; | |||
81 | */ | 81 | */ |
82 | 82 | ||
83 | static unsigned long order = 0; /* number of memory requests */ | 83 | static unsigned long order = 0; /* number of memory requests */ |
84 | static LHASH *mh=NULL; /* hash-table of memory requests (address as key) */ | 84 | static LHASH *mh=NULL; /* hash-table of memory requests (address as key); |
85 | * access requires MALLOC2 lock */ | ||
85 | 86 | ||
86 | 87 | ||
87 | typedef struct app_mem_info_st | 88 | typedef struct app_mem_info_st |
@@ -103,7 +104,8 @@ typedef struct app_mem_info_st | |||
103 | 104 | ||
104 | static LHASH *amih=NULL; /* hash-table with those app_mem_info_st's | 105 | static LHASH *amih=NULL; /* hash-table with those app_mem_info_st's |
105 | * that are at the top of their thread's stack | 106 | * that are at the top of their thread's stack |
106 | * (with `thread' as key) */ | 107 | * (with `thread' as key); |
108 | * access requires MALLOC2 lock */ | ||
107 | 109 | ||
108 | typedef struct mem_st | 110 | typedef struct mem_st |
109 | /* memory-block description */ | 111 | /* memory-block description */ |
@@ -128,7 +130,15 @@ static long options = /* extra information to be recorded */ | |||
128 | 0; | 130 | 0; |
129 | 131 | ||
130 | 132 | ||
131 | static unsigned long disabling_thread = 0; | 133 | static unsigned int num_disable = 0; /* num_disable > 0 |
134 | * iff | ||
135 | * mh_mode == CRYPTO_MEM_CHECK_ON (w/o ..._ENABLE) | ||
136 | */ | ||
137 | static unsigned long disabling_thread = 0; /* Valid iff num_disable > 0. | ||
138 | * CRYPTO_LOCK_MALLOC2 is locked | ||
139 | * exactly in this case (by the | ||
140 | * thread named in disabling_thread). | ||
141 | */ | ||
132 | 142 | ||
133 | int CRYPTO_mem_ctrl(int mode) | 143 | int CRYPTO_mem_ctrl(int mode) |
134 | { | 144 | { |
@@ -137,22 +147,23 @@ int CRYPTO_mem_ctrl(int mode) | |||
137 | CRYPTO_w_lock(CRYPTO_LOCK_MALLOC); | 147 | CRYPTO_w_lock(CRYPTO_LOCK_MALLOC); |
138 | switch (mode) | 148 | switch (mode) |
139 | { | 149 | { |
140 | /* for applications: */ | 150 | /* for applications (not to be called while multiple threads |
151 | * use the library): */ | ||
141 | case CRYPTO_MEM_CHECK_ON: /* aka MemCheck_start() */ | 152 | case CRYPTO_MEM_CHECK_ON: /* aka MemCheck_start() */ |
142 | mh_mode = CRYPTO_MEM_CHECK_ON|CRYPTO_MEM_CHECK_ENABLE; | 153 | mh_mode = CRYPTO_MEM_CHECK_ON|CRYPTO_MEM_CHECK_ENABLE; |
143 | disabling_thread = 0; | 154 | num_disable = 0; |
144 | break; | 155 | break; |
145 | case CRYPTO_MEM_CHECK_OFF: /* aka MemCheck_stop() */ | 156 | case CRYPTO_MEM_CHECK_OFF: /* aka MemCheck_stop() */ |
146 | mh_mode = 0; | 157 | mh_mode = 0; |
147 | disabling_thread = 0; | 158 | num_disable = 0; /* should be true *before* MemCheck_stop is used, |
159 | or there'll be a lot of confusion */ | ||
148 | break; | 160 | break; |
149 | 161 | ||
150 | /* switch off temporarily (for library-internal use): */ | 162 | /* switch off temporarily (for library-internal use): */ |
151 | case CRYPTO_MEM_CHECK_DISABLE: /* aka MemCheck_off() */ | 163 | case CRYPTO_MEM_CHECK_DISABLE: /* aka MemCheck_off() */ |
152 | if (mh_mode & CRYPTO_MEM_CHECK_ON) | 164 | if (mh_mode & CRYPTO_MEM_CHECK_ON) |
153 | { | 165 | { |
154 | mh_mode&= ~CRYPTO_MEM_CHECK_ENABLE; | 166 | if (!num_disable || (disabling_thread != CRYPTO_thread_id())) /* otherwise we already have the MALLOC2 lock */ |
155 | if (disabling_thread != CRYPTO_thread_id()) /* otherwise we already have the MALLOC2 lock */ | ||
156 | { | 167 | { |
157 | /* Long-time lock CRYPTO_LOCK_MALLOC2 must not be claimed while | 168 | /* Long-time lock CRYPTO_LOCK_MALLOC2 must not be claimed while |
158 | * we're holding CRYPTO_LOCK_MALLOC, or we'll deadlock if | 169 | * we're holding CRYPTO_LOCK_MALLOC, or we'll deadlock if |
@@ -169,18 +180,23 @@ int CRYPTO_mem_ctrl(int mode) | |||
169 | * OpenSSL threads. */ | 180 | * OpenSSL threads. */ |
170 | CRYPTO_w_lock(CRYPTO_LOCK_MALLOC2); | 181 | CRYPTO_w_lock(CRYPTO_LOCK_MALLOC2); |
171 | CRYPTO_w_lock(CRYPTO_LOCK_MALLOC); | 182 | CRYPTO_w_lock(CRYPTO_LOCK_MALLOC); |
183 | mh_mode &= ~CRYPTO_MEM_CHECK_ENABLE; | ||
172 | disabling_thread=CRYPTO_thread_id(); | 184 | disabling_thread=CRYPTO_thread_id(); |
173 | } | 185 | } |
186 | num_disable++; | ||
174 | } | 187 | } |
175 | break; | 188 | break; |
176 | case CRYPTO_MEM_CHECK_ENABLE: /* aka MemCheck_on() */ | 189 | case CRYPTO_MEM_CHECK_ENABLE: /* aka MemCheck_on() */ |
177 | if (mh_mode & CRYPTO_MEM_CHECK_ON) | 190 | if (mh_mode & CRYPTO_MEM_CHECK_ON) |
178 | { | 191 | { |
179 | mh_mode|=CRYPTO_MEM_CHECK_ENABLE; | 192 | if (num_disable) /* always true, or something is going wrong */ |
180 | if (disabling_thread != 0) | ||
181 | { | 193 | { |
182 | disabling_thread=0; | 194 | num_disable--; |
183 | CRYPTO_w_unlock(CRYPTO_LOCK_MALLOC2); | 195 | if (num_disable == 0) |
196 | { | ||
197 | mh_mode|=CRYPTO_MEM_CHECK_ENABLE; | ||
198 | CRYPTO_w_unlock(CRYPTO_LOCK_MALLOC2); | ||
199 | } | ||
184 | } | 200 | } |
185 | } | 201 | } |
186 | break; | 202 | break; |
@@ -198,12 +214,12 @@ int CRYPTO_is_mem_check_on(void) | |||
198 | 214 | ||
199 | if (mh_mode & CRYPTO_MEM_CHECK_ON) | 215 | if (mh_mode & CRYPTO_MEM_CHECK_ON) |
200 | { | 216 | { |
201 | CRYPTO_w_lock(CRYPTO_LOCK_MALLOC); | 217 | CRYPTO_r_lock(CRYPTO_LOCK_MALLOC); |
202 | 218 | ||
203 | ret = (mh_mode & CRYPTO_MEM_CHECK_ENABLE) | 219 | ret = (mh_mode & CRYPTO_MEM_CHECK_ENABLE) |
204 | && disabling_thread != CRYPTO_thread_id(); | 220 | || (disabling_thread != CRYPTO_thread_id()); |
205 | 221 | ||
206 | CRYPTO_w_unlock(CRYPTO_LOCK_MALLOC); | 222 | CRYPTO_r_unlock(CRYPTO_LOCK_MALLOC); |
207 | } | 223 | } |
208 | return(ret); | 224 | return(ret); |
209 | } | 225 | } |
@@ -293,7 +309,7 @@ int CRYPTO_push_info_(const char *info, const char *file, int line) | |||
293 | 309 | ||
294 | if (is_MemCheck_on()) | 310 | if (is_MemCheck_on()) |
295 | { | 311 | { |
296 | MemCheck_off(); /* obtains CRYPTO_LOCK_MALLOC2 */ | 312 | MemCheck_off(); /* obtain MALLOC2 lock */ |
297 | 313 | ||
298 | if ((ami = (APP_INFO *)OPENSSL_malloc(sizeof(APP_INFO))) == NULL) | 314 | if ((ami = (APP_INFO *)OPENSSL_malloc(sizeof(APP_INFO))) == NULL) |
299 | { | 315 | { |
@@ -330,7 +346,7 @@ int CRYPTO_push_info_(const char *info, const char *file, int line) | |||
330 | ami->next=amim; | 346 | ami->next=amim; |
331 | } | 347 | } |
332 | err: | 348 | err: |
333 | MemCheck_on(); /* releases CRYPTO_LOCK_MALLOC2 */ | 349 | MemCheck_on(); /* release MALLOC2 lock */ |
334 | } | 350 | } |
335 | 351 | ||
336 | return(ret); | 352 | return(ret); |
@@ -342,11 +358,11 @@ int CRYPTO_pop_info(void) | |||
342 | 358 | ||
343 | if (is_MemCheck_on()) /* _must_ be true, or something went severely wrong */ | 359 | if (is_MemCheck_on()) /* _must_ be true, or something went severely wrong */ |
344 | { | 360 | { |
345 | MemCheck_off(); /* obtains CRYPTO_LOCK_MALLOC2 */ | 361 | MemCheck_off(); /* obtain MALLOC2 lock */ |
346 | 362 | ||
347 | ret=(pop_info() != NULL); | 363 | ret=(pop_info() != NULL); |
348 | 364 | ||
349 | MemCheck_on(); /* releases CRYPTO_LOCK_MALLOC2 */ | 365 | MemCheck_on(); /* release MALLOC2 lock */ |
350 | } | 366 | } |
351 | return(ret); | 367 | return(ret); |
352 | } | 368 | } |
@@ -357,12 +373,12 @@ int CRYPTO_remove_all_info(void) | |||
357 | 373 | ||
358 | if (is_MemCheck_on()) /* _must_ be true */ | 374 | if (is_MemCheck_on()) /* _must_ be true */ |
359 | { | 375 | { |
360 | MemCheck_off(); /* obtains CRYPTO_LOCK_MALLOC2 */ | 376 | MemCheck_off(); /* obtain MALLOC2 lock */ |
361 | 377 | ||
362 | while(pop_info() != NULL) | 378 | while(pop_info() != NULL) |
363 | ret++; | 379 | ret++; |
364 | 380 | ||
365 | MemCheck_on(); /* releases CRYPTO_LOCK_MALLOC2 */ | 381 | MemCheck_on(); /* release MALLOC2 lock */ |
366 | } | 382 | } |
367 | return(ret); | 383 | return(ret); |
368 | } | 384 | } |
@@ -385,11 +401,12 @@ void CRYPTO_dbg_malloc(void *addr, int num, const char *file, int line, | |||
385 | 401 | ||
386 | if (is_MemCheck_on()) | 402 | if (is_MemCheck_on()) |
387 | { | 403 | { |
388 | MemCheck_off(); /* obtains CRYPTO_LOCK_MALLOC2 */ | 404 | MemCheck_off(); /* make sure we hold MALLOC2 lock */ |
389 | if ((m=(MEM *)OPENSSL_malloc(sizeof(MEM))) == NULL) | 405 | if ((m=(MEM *)OPENSSL_malloc(sizeof(MEM))) == NULL) |
390 | { | 406 | { |
391 | OPENSSL_free(addr); | 407 | OPENSSL_free(addr); |
392 | MemCheck_on(); /* releases CRYPTO_LOCK_MALLOC2 */ | 408 | MemCheck_on(); /* release MALLOC2 lock |
409 | * if num_disabled drops to 0 */ | ||
393 | return; | 410 | return; |
394 | } | 411 | } |
395 | if (mh == NULL) | 412 | if (mh == NULL) |
@@ -448,7 +465,8 @@ void CRYPTO_dbg_malloc(void *addr, int num, const char *file, int line, | |||
448 | OPENSSL_free(mm); | 465 | OPENSSL_free(mm); |
449 | } | 466 | } |
450 | err: | 467 | err: |
451 | MemCheck_on(); /* releases CRYPTO_LOCK_MALLOC2 */ | 468 | MemCheck_on(); /* release MALLOC2 lock |
469 | * if num_disabled drops to 0 */ | ||
452 | } | 470 | } |
453 | break; | 471 | break; |
454 | } | 472 | } |
@@ -467,7 +485,7 @@ void CRYPTO_dbg_free(void *addr, int before_p) | |||
467 | 485 | ||
468 | if (is_MemCheck_on() && (mh != NULL)) | 486 | if (is_MemCheck_on() && (mh != NULL)) |
469 | { | 487 | { |
470 | MemCheck_off(); | 488 | MemCheck_off(); /* make sure we hold MALLOC2 lock */ |
471 | 489 | ||
472 | m.addr=addr; | 490 | m.addr=addr; |
473 | mp=(MEM *)lh_delete(mh,(char *)&m); | 491 | mp=(MEM *)lh_delete(mh,(char *)&m); |
@@ -484,7 +502,8 @@ void CRYPTO_dbg_free(void *addr, int before_p) | |||
484 | OPENSSL_free(mp); | 502 | OPENSSL_free(mp); |
485 | } | 503 | } |
486 | 504 | ||
487 | MemCheck_on(); /* releases CRYPTO_LOCK_MALLOC2 */ | 505 | MemCheck_on(); /* release MALLOC2 lock |
506 | * if num_disabled drops to 0 */ | ||
488 | } | 507 | } |
489 | break; | 508 | break; |
490 | case 1: | 509 | case 1: |
@@ -518,7 +537,7 @@ void CRYPTO_dbg_realloc(void *addr1, void *addr2, int num, | |||
518 | 537 | ||
519 | if (is_MemCheck_on()) | 538 | if (is_MemCheck_on()) |
520 | { | 539 | { |
521 | MemCheck_off(); /* obtains CRYPTO_LOCK_MALLOC2 */ | 540 | MemCheck_off(); /* make sure we hold MALLOC2 lock */ |
522 | 541 | ||
523 | m.addr=addr1; | 542 | m.addr=addr1; |
524 | mp=(MEM *)lh_delete(mh,(char *)&m); | 543 | mp=(MEM *)lh_delete(mh,(char *)&m); |
@@ -535,7 +554,8 @@ void CRYPTO_dbg_realloc(void *addr1, void *addr2, int num, | |||
535 | lh_insert(mh,(char *)mp); | 554 | lh_insert(mh,(char *)mp); |
536 | } | 555 | } |
537 | 556 | ||
538 | MemCheck_on(); /* releases CRYPTO_LOCK_MALLOC2 */ | 557 | MemCheck_on(); /* release MALLOC2 lock |
558 | * if num_disabled drops to 0 */ | ||
539 | } | 559 | } |
540 | break; | 560 | break; |
541 | } | 561 | } |
@@ -642,10 +662,12 @@ void CRYPTO_mem_leaks(BIO *b) | |||
642 | 662 | ||
643 | if (mh == NULL && amih == NULL) | 663 | if (mh == NULL && amih == NULL) |
644 | return; | 664 | return; |
665 | |||
666 | MemCheck_off(); /* obtain MALLOC2 lock */ | ||
667 | |||
645 | ml.bio=b; | 668 | ml.bio=b; |
646 | ml.bytes=0; | 669 | ml.bytes=0; |
647 | ml.chunks=0; | 670 | ml.chunks=0; |
648 | MemCheck_off(); /* obtains CRYPTO_LOCK_MALLOC2 */ | ||
649 | if (mh != NULL) | 671 | if (mh != NULL) |
650 | lh_doall_arg(mh,(void (*)())print_leak,(char *)&ml); | 672 | lh_doall_arg(mh,(void (*)())print_leak,(char *)&ml); |
651 | if (ml.chunks != 0) | 673 | if (ml.chunks != 0) |
@@ -671,7 +693,15 @@ void CRYPTO_mem_leaks(BIO *b) | |||
671 | * void_fn_to_char kludge in CRYPTO_mem_leaks_cb. | 693 | * void_fn_to_char kludge in CRYPTO_mem_leaks_cb. |
672 | * Otherwise the code police will come and get us.) | 694 | * Otherwise the code police will come and get us.) |
673 | */ | 695 | */ |
696 | int old_mh_mode; | ||
697 | |||
674 | CRYPTO_w_lock(CRYPTO_LOCK_MALLOC); | 698 | CRYPTO_w_lock(CRYPTO_LOCK_MALLOC); |
699 | |||
700 | /* avoid deadlock when lh_free() uses CRYPTO_dbg_free(), | ||
701 | * which uses CRYPTO_is_mem_check_on */ | ||
702 | old_mh_mode = mh_mode; | ||
703 | mh_mode = CRYPTO_MEM_CHECK_OFF; | ||
704 | |||
675 | if (mh != NULL) | 705 | if (mh != NULL) |
676 | { | 706 | { |
677 | lh_free(mh); | 707 | lh_free(mh); |
@@ -685,15 +715,11 @@ void CRYPTO_mem_leaks(BIO *b) | |||
685 | amih = NULL; | 715 | amih = NULL; |
686 | } | 716 | } |
687 | } | 717 | } |
718 | |||
719 | mh_mode = old_mh_mode; | ||
688 | CRYPTO_w_unlock(CRYPTO_LOCK_MALLOC); | 720 | CRYPTO_w_unlock(CRYPTO_LOCK_MALLOC); |
689 | } | 721 | } |
690 | MemCheck_on(); /* releases CRYPTO_LOCK_MALLOC2 */ | 722 | MemCheck_on(); /* release MALLOC2 lock */ |
691 | |||
692 | #if 0 | ||
693 | lh_stats_bio(mh,b); | ||
694 | lh_node_stats_bio(mh,b); | ||
695 | lh_node_usage_stats_bio(mh,b); | ||
696 | #endif | ||
697 | } | 723 | } |
698 | 724 | ||
699 | #ifndef NO_FP_API | 725 | #ifndef NO_FP_API |
diff --git a/src/lib/libcrypto/objects/Makefile.ssl b/src/lib/libcrypto/objects/Makefile.ssl index bdb7aa94dc..6746ad21e7 100644 --- a/src/lib/libcrypto/objects/Makefile.ssl +++ b/src/lib/libcrypto/objects/Makefile.ssl | |||
@@ -39,7 +39,8 @@ all: obj_dat.h lib | |||
39 | 39 | ||
40 | lib: $(LIBOBJ) | 40 | lib: $(LIBOBJ) |
41 | $(AR) $(LIB) $(LIBOBJ) | 41 | $(AR) $(LIB) $(LIBOBJ) |
42 | $(RANLIB) $(LIB) | 42 | @echo You may get an error following this line. Please ignore. |
43 | - $(RANLIB) $(LIB) | ||
43 | @touch lib | 44 | @touch lib |
44 | 45 | ||
45 | files: | 46 | files: |
diff --git a/src/lib/libcrypto/opensslv.h b/src/lib/libcrypto/opensslv.h index 6b5aedeea6..dc50f6d7da 100644 --- a/src/lib/libcrypto/opensslv.h +++ b/src/lib/libcrypto/opensslv.h | |||
@@ -25,8 +25,8 @@ | |||
25 | * (Prior to 0.9.5a beta1, a different scheme was used: MMNNFFRBB for | 25 | * (Prior to 0.9.5a beta1, a different scheme was used: MMNNFFRBB for |
26 | * major minor fix final patch/beta) | 26 | * major minor fix final patch/beta) |
27 | */ | 27 | */ |
28 | #define OPENSSL_VERSION_NUMBER 0x0090600fL | 28 | #define OPENSSL_VERSION_NUMBER 0x0090601fL |
29 | #define OPENSSL_VERSION_TEXT "OpenSSL 0.9.6 [engine] 24 Sep 2000" | 29 | #define OPENSSL_VERSION_TEXT "OpenSSL 0.9.6a [engine] 5 Apr 2001" |
30 | #define OPENSSL_VERSION_PTEXT " part of " OPENSSL_VERSION_TEXT | 30 | #define OPENSSL_VERSION_PTEXT " part of " OPENSSL_VERSION_TEXT |
31 | 31 | ||
32 | 32 | ||
diff --git a/src/lib/libcrypto/pem/Makefile.ssl b/src/lib/libcrypto/pem/Makefile.ssl index 97af8255a3..31db6b65a1 100644 --- a/src/lib/libcrypto/pem/Makefile.ssl +++ b/src/lib/libcrypto/pem/Makefile.ssl | |||
@@ -40,7 +40,8 @@ all: lib | |||
40 | 40 | ||
41 | lib: $(LIBOBJ) | 41 | lib: $(LIBOBJ) |
42 | $(AR) $(LIB) $(LIBOBJ) | 42 | $(AR) $(LIB) $(LIBOBJ) |
43 | $(RANLIB) $(LIB) | 43 | @echo You may get an error following this line. Please ignore. |
44 | - $(RANLIB) $(LIB) | ||
44 | @touch lib | 45 | @touch lib |
45 | 46 | ||
46 | files: | 47 | files: |
diff --git a/src/lib/libcrypto/pem/pem_info.c b/src/lib/libcrypto/pem/pem_info.c index 1c5c6dea00..f1694f1125 100644 --- a/src/lib/libcrypto/pem/pem_info.c +++ b/src/lib/libcrypto/pem/pem_info.c | |||
@@ -305,7 +305,7 @@ int PEM_X509_INFO_write_bio(BIO *bp, X509_INFO *xi, EVP_CIPHER *enc, | |||
305 | { | 305 | { |
306 | if ( (xi->enc_data!=NULL) && (xi->enc_len>0) ) | 306 | if ( (xi->enc_data!=NULL) && (xi->enc_len>0) ) |
307 | { | 307 | { |
308 | /* copy from wierdo names into more normal things */ | 308 | /* copy from weirdo names into more normal things */ |
309 | iv=xi->enc_cipher.iv; | 309 | iv=xi->enc_cipher.iv; |
310 | data=(unsigned char *)xi->enc_data; | 310 | data=(unsigned char *)xi->enc_data; |
311 | i=xi->enc_len; | 311 | i=xi->enc_len; |
diff --git a/src/lib/libcrypto/pkcs12/Makefile.ssl b/src/lib/libcrypto/pkcs12/Makefile.ssl index 67869f204f..d745c53621 100644 --- a/src/lib/libcrypto/pkcs12/Makefile.ssl +++ b/src/lib/libcrypto/pkcs12/Makefile.ssl | |||
@@ -45,7 +45,8 @@ all: lib | |||
45 | 45 | ||
46 | lib: $(LIBOBJ) | 46 | lib: $(LIBOBJ) |
47 | $(AR) $(LIB) $(LIBOBJ) | 47 | $(AR) $(LIB) $(LIBOBJ) |
48 | $(RANLIB) $(LIB) | 48 | @echo You may get an error following this line. Please ignore. |
49 | - $(RANLIB) $(LIB) | ||
49 | @touch lib | 50 | @touch lib |
50 | 51 | ||
51 | files: | 52 | files: |
diff --git a/src/lib/libcrypto/pkcs12/p12_attr.c b/src/lib/libcrypto/pkcs12/p12_attr.c index f1a210b5d2..a16a97d03d 100644 --- a/src/lib/libcrypto/pkcs12/p12_attr.c +++ b/src/lib/libcrypto/pkcs12/p12_attr.c | |||
@@ -151,7 +151,7 @@ int PKCS12_add_friendlyname_asc (PKCS12_SAFEBAG *bag, const char *name, | |||
151 | { | 151 | { |
152 | unsigned char *uniname; | 152 | unsigned char *uniname; |
153 | int ret, unilen; | 153 | int ret, unilen; |
154 | if (!asc2uni(name, &uniname, &unilen)) { | 154 | if (!asc2uni(name, namelen, &uniname, &unilen)) { |
155 | PKCS12err(PKCS12_F_PKCS12_ADD_FRIENDLYNAME_ASC, | 155 | PKCS12err(PKCS12_F_PKCS12_ADD_FRIENDLYNAME_ASC, |
156 | ERR_R_MALLOC_FAILURE); | 156 | ERR_R_MALLOC_FAILURE); |
157 | return 0; | 157 | return 0; |
diff --git a/src/lib/libcrypto/pkcs12/p12_key.c b/src/lib/libcrypto/pkcs12/p12_key.c index b042dcf05c..a4fd5b98ec 100644 --- a/src/lib/libcrypto/pkcs12/p12_key.c +++ b/src/lib/libcrypto/pkcs12/p12_key.c | |||
@@ -84,7 +84,7 @@ int PKCS12_key_gen_asc(const char *pass, int passlen, unsigned char *salt, | |||
84 | if(!pass) { | 84 | if(!pass) { |
85 | unipass = NULL; | 85 | unipass = NULL; |
86 | uniplen = 0; | 86 | uniplen = 0; |
87 | } else if (!asc2uni(pass, &unipass, &uniplen)) { | 87 | } else if (!asc2uni(pass, passlen, &unipass, &uniplen)) { |
88 | PKCS12err(PKCS12_F_PKCS12_KEY_GEN_ASC,ERR_R_MALLOC_FAILURE); | 88 | PKCS12err(PKCS12_F_PKCS12_KEY_GEN_ASC,ERR_R_MALLOC_FAILURE); |
89 | return 0; | 89 | return 0; |
90 | } | 90 | } |
@@ -102,7 +102,7 @@ int PKCS12_key_gen_uni(unsigned char *pass, int passlen, unsigned char *salt, | |||
102 | const EVP_MD *md_type) | 102 | const EVP_MD *md_type) |
103 | { | 103 | { |
104 | unsigned char *B, *D, *I, *p, *Ai; | 104 | unsigned char *B, *D, *I, *p, *Ai; |
105 | int Slen, Plen, Ilen; | 105 | int Slen, Plen, Ilen, Ijlen; |
106 | int i, j, u, v; | 106 | int i, j, u, v; |
107 | BIGNUM *Ij, *Bpl1; /* These hold Ij and B + 1 */ | 107 | BIGNUM *Ij, *Bpl1; /* These hold Ij and B + 1 */ |
108 | EVP_MD_CTX ctx; | 108 | EVP_MD_CTX ctx; |
@@ -180,10 +180,17 @@ int PKCS12_key_gen_uni(unsigned char *pass, int passlen, unsigned char *salt, | |||
180 | BN_bin2bn (I + j, v, Ij); | 180 | BN_bin2bn (I + j, v, Ij); |
181 | BN_add (Ij, Ij, Bpl1); | 181 | BN_add (Ij, Ij, Bpl1); |
182 | BN_bn2bin (Ij, B); | 182 | BN_bn2bin (Ij, B); |
183 | Ijlen = BN_num_bytes (Ij); | ||
183 | /* If more than 2^(v*8) - 1 cut off MSB */ | 184 | /* If more than 2^(v*8) - 1 cut off MSB */ |
184 | if (BN_num_bytes (Ij) > v) { | 185 | if (Ijlen > v) { |
185 | BN_bn2bin (Ij, B); | 186 | BN_bn2bin (Ij, B); |
186 | memcpy (I + j, B + 1, v); | 187 | memcpy (I + j, B + 1, v); |
188 | #ifndef PKCS12_BROKEN_KEYGEN | ||
189 | /* If less than v bytes pad with zeroes */ | ||
190 | } else if (Ijlen < v) { | ||
191 | memset(I + j, 0, v - Ijlen); | ||
192 | BN_bn2bin(Ij, I + j + v - Ijlen); | ||
193 | #endif | ||
187 | } else BN_bn2bin (Ij, I + j); | 194 | } else BN_bn2bin (Ij, I + j); |
188 | } | 195 | } |
189 | } | 196 | } |
diff --git a/src/lib/libcrypto/pkcs12/p12_kiss.c b/src/lib/libcrypto/pkcs12/p12_kiss.c index 1fbbd6c99f..5d67f19b45 100644 --- a/src/lib/libcrypto/pkcs12/p12_kiss.c +++ b/src/lib/libcrypto/pkcs12/p12_kiss.c | |||
@@ -264,6 +264,7 @@ static int parse_bag(PKCS12_SAFEBAG *bag, const char *pass, int passlen, | |||
264 | if (lkey) { | 264 | if (lkey) { |
265 | *keymatch |= MATCH_CERT; | 265 | *keymatch |= MATCH_CERT; |
266 | if (cert) *cert = x509; | 266 | if (cert) *cert = x509; |
267 | else X509_free(x509); | ||
267 | } else { | 268 | } else { |
268 | if(ca) sk_X509_push (*ca, x509); | 269 | if(ca) sk_X509_push (*ca, x509); |
269 | else X509_free(x509); | 270 | else X509_free(x509); |
diff --git a/src/lib/libcrypto/pkcs12/p12_utl.c b/src/lib/libcrypto/pkcs12/p12_utl.c index 17f41b4549..2f1d1e534f 100644 --- a/src/lib/libcrypto/pkcs12/p12_utl.c +++ b/src/lib/libcrypto/pkcs12/p12_utl.c | |||
@@ -62,30 +62,34 @@ | |||
62 | 62 | ||
63 | /* Cheap and nasty Unicode stuff */ | 63 | /* Cheap and nasty Unicode stuff */ |
64 | 64 | ||
65 | unsigned char *asc2uni (const char *asc, unsigned char **uni, int *unilen) | 65 | unsigned char *asc2uni(const char *asc, int asclen, unsigned char **uni, int *unilen) |
66 | { | 66 | { |
67 | int ulen, i; | 67 | int ulen, i; |
68 | unsigned char *unitmp; | 68 | unsigned char *unitmp; |
69 | ulen = strlen(asc)*2 + 2; | 69 | if (asclen == -1) asclen = strlen(asc); |
70 | if (!(unitmp = OPENSSL_malloc (ulen))) return NULL; | 70 | ulen = asclen*2 + 2; |
71 | for (i = 0; i < ulen; i+=2) { | 71 | if (!(unitmp = OPENSSL_malloc(ulen))) return NULL; |
72 | for (i = 0; i < ulen - 2; i+=2) { | ||
72 | unitmp[i] = 0; | 73 | unitmp[i] = 0; |
73 | unitmp[i + 1] = asc[i>>1]; | 74 | unitmp[i + 1] = asc[i>>1]; |
74 | } | 75 | } |
76 | /* Make result double null terminated */ | ||
77 | unitmp[ulen - 2] = 0; | ||
78 | unitmp[ulen - 1] = 0; | ||
75 | if (unilen) *unilen = ulen; | 79 | if (unilen) *unilen = ulen; |
76 | if (uni) *uni = unitmp; | 80 | if (uni) *uni = unitmp; |
77 | return unitmp; | 81 | return unitmp; |
78 | } | 82 | } |
79 | 83 | ||
80 | char *uni2asc (unsigned char *uni, int unilen) | 84 | char *uni2asc(unsigned char *uni, int unilen) |
81 | { | 85 | { |
82 | int asclen, i; | 86 | int asclen, i; |
83 | char *asctmp; | 87 | char *asctmp; |
84 | asclen = unilen / 2; | 88 | asclen = unilen / 2; |
85 | /* If no terminating zero allow for one */ | 89 | /* If no terminating zero allow for one */ |
86 | if (uni[unilen - 1]) asclen++; | 90 | if (!unilen || uni[unilen - 1]) asclen++; |
87 | uni++; | 91 | uni++; |
88 | if (!(asctmp = OPENSSL_malloc (asclen))) return NULL; | 92 | if (!(asctmp = OPENSSL_malloc(asclen))) return NULL; |
89 | for (i = 0; i < unilen; i+=2) asctmp[i>>1] = uni[i]; | 93 | for (i = 0; i < unilen; i+=2) asctmp[i>>1] = uni[i]; |
90 | asctmp[asclen - 1] = 0; | 94 | asctmp[asclen - 1] = 0; |
91 | return asctmp; | 95 | return asctmp; |
diff --git a/src/lib/libcrypto/pkcs12/pkcs12.h b/src/lib/libcrypto/pkcs12/pkcs12.h index 502fceff95..e529154f26 100644 --- a/src/lib/libcrypto/pkcs12/pkcs12.h +++ b/src/lib/libcrypto/pkcs12/pkcs12.h | |||
@@ -247,7 +247,7 @@ int PKCS12_set_mac(PKCS12 *p12, const char *pass, int passlen, | |||
247 | EVP_MD *md_type); | 247 | EVP_MD *md_type); |
248 | int PKCS12_setup_mac(PKCS12 *p12, int iter, unsigned char *salt, | 248 | int PKCS12_setup_mac(PKCS12 *p12, int iter, unsigned char *salt, |
249 | int saltlen, EVP_MD *md_type); | 249 | int saltlen, EVP_MD *md_type); |
250 | unsigned char *asc2uni(const char *asc, unsigned char **uni, int *unilen); | 250 | unsigned char *asc2uni(const char *asc, int asclen, unsigned char **uni, int *unilen); |
251 | char *uni2asc(unsigned char *uni, int unilen); | 251 | char *uni2asc(unsigned char *uni, int unilen); |
252 | int i2d_PKCS12_BAGS(PKCS12_BAGS *a, unsigned char **pp); | 252 | int i2d_PKCS12_BAGS(PKCS12_BAGS *a, unsigned char **pp); |
253 | PKCS12_BAGS *PKCS12_BAGS_new(void); | 253 | PKCS12_BAGS *PKCS12_BAGS_new(void); |
diff --git a/src/lib/libcrypto/pkcs7/Makefile.ssl b/src/lib/libcrypto/pkcs7/Makefile.ssl index 6cd18b671e..37b72f0890 100644 --- a/src/lib/libcrypto/pkcs7/Makefile.ssl +++ b/src/lib/libcrypto/pkcs7/Makefile.ssl | |||
@@ -58,7 +58,8 @@ verify: verify.o example.o lib | |||
58 | 58 | ||
59 | lib: $(LIBOBJ) | 59 | lib: $(LIBOBJ) |
60 | $(AR) $(LIB) $(LIBOBJ) | 60 | $(AR) $(LIB) $(LIBOBJ) |
61 | $(RANLIB) $(LIB) | 61 | @echo You may get an error following this line. Please ignore. |
62 | - $(RANLIB) $(LIB) | ||
62 | @touch lib | 63 | @touch lib |
63 | 64 | ||
64 | files: | 65 | files: |
diff --git a/src/lib/libcrypto/pkcs7/pk7_doit.c b/src/lib/libcrypto/pkcs7/pk7_doit.c index 099e9651c1..bf43d030ad 100644 --- a/src/lib/libcrypto/pkcs7/pk7_doit.c +++ b/src/lib/libcrypto/pkcs7/pk7_doit.c | |||
@@ -370,7 +370,7 @@ BIO *PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert) | |||
370 | if (ri == NULL) { | 370 | if (ri == NULL) { |
371 | PKCS7err(PKCS7_F_PKCS7_DATADECODE, | 371 | PKCS7err(PKCS7_F_PKCS7_DATADECODE, |
372 | PKCS7_R_NO_RECIPIENT_MATCHES_CERTIFICATE); | 372 | PKCS7_R_NO_RECIPIENT_MATCHES_CERTIFICATE); |
373 | return(NULL); | 373 | goto err; |
374 | } | 374 | } |
375 | 375 | ||
376 | jj=EVP_PKEY_size(pkey); | 376 | jj=EVP_PKEY_size(pkey); |
@@ -393,7 +393,7 @@ BIO *PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert) | |||
393 | BIO_get_cipher_ctx(etmp,&evp_ctx); | 393 | BIO_get_cipher_ctx(etmp,&evp_ctx); |
394 | EVP_CipherInit(evp_ctx,evp_cipher,NULL,NULL,0); | 394 | EVP_CipherInit(evp_ctx,evp_cipher,NULL,NULL,0); |
395 | if (EVP_CIPHER_asn1_to_param(evp_ctx,enc_alg->parameter) < 0) | 395 | if (EVP_CIPHER_asn1_to_param(evp_ctx,enc_alg->parameter) < 0) |
396 | return(NULL); | 396 | goto err; |
397 | 397 | ||
398 | if (jj != EVP_CIPHER_CTX_key_length(evp_ctx)) { | 398 | if (jj != EVP_CIPHER_CTX_key_length(evp_ctx)) { |
399 | /* Some S/MIME clients don't use the same key | 399 | /* Some S/MIME clients don't use the same key |
@@ -588,8 +588,10 @@ int PKCS7_dataFinal(PKCS7 *p7, BIO *bio) | |||
588 | pp=NULL; | 588 | pp=NULL; |
589 | } | 589 | } |
590 | 590 | ||
591 | #ifndef NO_DSA | ||
591 | if (si->pkey->type == EVP_PKEY_DSA) | 592 | if (si->pkey->type == EVP_PKEY_DSA) |
592 | ctx_tmp.digest=EVP_dss1(); | 593 | ctx_tmp.digest=EVP_dss1(); |
594 | #endif | ||
593 | 595 | ||
594 | if (!EVP_SignFinal(&ctx_tmp,(unsigned char *)buf->data, | 596 | if (!EVP_SignFinal(&ctx_tmp,(unsigned char *)buf->data, |
595 | (unsigned int *)&buf->length,si->pkey)) | 597 | (unsigned int *)&buf->length,si->pkey)) |
@@ -783,7 +785,14 @@ for (ii=0; ii<md_len; ii++) printf("%02X",md_dat[ii]); printf(" calc\n"); | |||
783 | 785 | ||
784 | os=si->enc_digest; | 786 | os=si->enc_digest; |
785 | pkey = X509_get_pubkey(x509); | 787 | pkey = X509_get_pubkey(x509); |
788 | if (!pkey) | ||
789 | { | ||
790 | ret = -1; | ||
791 | goto err; | ||
792 | } | ||
793 | #ifndef NO_DSA | ||
786 | if(pkey->type == EVP_PKEY_DSA) mdc_tmp.digest=EVP_dss1(); | 794 | if(pkey->type == EVP_PKEY_DSA) mdc_tmp.digest=EVP_dss1(); |
795 | #endif | ||
787 | 796 | ||
788 | i=EVP_VerifyFinal(&mdc_tmp,os->data,os->length, pkey); | 797 | i=EVP_VerifyFinal(&mdc_tmp,os->data,os->length, pkey); |
789 | EVP_PKEY_free(pkey); | 798 | EVP_PKEY_free(pkey); |
diff --git a/src/lib/libcrypto/pkcs7/pk7_mime.c b/src/lib/libcrypto/pkcs7/pk7_mime.c index 994473c0bd..086d394270 100644 --- a/src/lib/libcrypto/pkcs7/pk7_mime.c +++ b/src/lib/libcrypto/pkcs7/pk7_mime.c | |||
@@ -165,9 +165,9 @@ int SMIME_write_PKCS7(BIO *bio, PKCS7 *p7, BIO *data, int flags) | |||
165 | } | 165 | } |
166 | bound[32] = 0; | 166 | bound[32] = 0; |
167 | BIO_printf(bio, "MIME-Version: 1.0\n"); | 167 | BIO_printf(bio, "MIME-Version: 1.0\n"); |
168 | BIO_printf(bio, "Content-Type: multipart/signed ; "); | 168 | BIO_printf(bio, "Content-Type: multipart/signed;"); |
169 | BIO_printf(bio, "protocol=\"application/x-pkcs7-signature\" ; "); | 169 | BIO_printf(bio, " protocol=\"application/x-pkcs7-signature\";"); |
170 | BIO_printf(bio, "micalg=sha1 ; boundary=\"----%s\"\n\n", bound); | 170 | BIO_printf(bio, " micalg=sha1; boundary=\"----%s\"\n\n", bound); |
171 | BIO_printf(bio, "This is an S/MIME signed message\n\n"); | 171 | BIO_printf(bio, "This is an S/MIME signed message\n\n"); |
172 | /* Now write out the first part */ | 172 | /* Now write out the first part */ |
173 | BIO_printf(bio, "------%s\n", bound); | 173 | BIO_printf(bio, "------%s\n", bound); |
diff --git a/src/lib/libcrypto/pkcs7/pk7_smime.c b/src/lib/libcrypto/pkcs7/pk7_smime.c index d716f9faeb..3d3214f5ee 100644 --- a/src/lib/libcrypto/pkcs7/pk7_smime.c +++ b/src/lib/libcrypto/pkcs7/pk7_smime.c | |||
@@ -153,7 +153,7 @@ int PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store, | |||
153 | PKCS7_SIGNER_INFO *si; | 153 | PKCS7_SIGNER_INFO *si; |
154 | X509_STORE_CTX cert_ctx; | 154 | X509_STORE_CTX cert_ctx; |
155 | char buf[4096]; | 155 | char buf[4096]; |
156 | int i, j=0, k; | 156 | int i, j=0, k, ret = 0; |
157 | BIO *p7bio; | 157 | BIO *p7bio; |
158 | BIO *tmpout; | 158 | BIO *tmpout; |
159 | 159 | ||
@@ -258,18 +258,15 @@ int PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store, | |||
258 | } | 258 | } |
259 | } | 259 | } |
260 | 260 | ||
261 | sk_X509_free(signers); | 261 | ret = 1; |
262 | if(indata) BIO_pop(p7bio); | ||
263 | BIO_free_all(p7bio); | ||
264 | |||
265 | return 1; | ||
266 | 262 | ||
267 | err: | 263 | err: |
268 | 264 | ||
265 | if(indata) BIO_pop(p7bio); | ||
266 | BIO_free_all(p7bio); | ||
269 | sk_X509_free(signers); | 267 | sk_X509_free(signers); |
270 | BIO_free(p7bio); | ||
271 | 268 | ||
272 | return 0; | 269 | return ret; |
273 | } | 270 | } |
274 | 271 | ||
275 | STACK_OF(X509) *PKCS7_get0_signers(PKCS7 *p7, STACK_OF(X509) *certs, int flags) | 272 | STACK_OF(X509) *PKCS7_get0_signers(PKCS7 *p7, STACK_OF(X509) *certs, int flags) |
diff --git a/src/lib/libcrypto/rand/Makefile.ssl b/src/lib/libcrypto/rand/Makefile.ssl index 5f6199a35f..707eaac678 100644 --- a/src/lib/libcrypto/rand/Makefile.ssl +++ b/src/lib/libcrypto/rand/Makefile.ssl | |||
@@ -39,7 +39,8 @@ all: lib | |||
39 | 39 | ||
40 | lib: $(LIBOBJ) | 40 | lib: $(LIBOBJ) |
41 | $(AR) $(LIB) $(LIBOBJ) | 41 | $(AR) $(LIB) $(LIBOBJ) |
42 | $(RANLIB) $(LIB) | 42 | @echo You may get an error following this line. Please ignore. |
43 | - $(RANLIB) $(LIB) | ||
43 | @touch lib | 44 | @touch lib |
44 | 45 | ||
45 | files: | 46 | files: |
diff --git a/src/lib/libcrypto/rand/md_rand.c b/src/lib/libcrypto/rand/md_rand.c index d167dea77d..567838f6c3 100644 --- a/src/lib/libcrypto/rand/md_rand.c +++ b/src/lib/libcrypto/rand/md_rand.c | |||
@@ -482,12 +482,12 @@ static int ssleay_rand_bytes(unsigned char *buf, int num) | |||
482 | unpredictable */ | 482 | unpredictable */ |
483 | static int ssleay_rand_pseudo_bytes(unsigned char *buf, int num) | 483 | static int ssleay_rand_pseudo_bytes(unsigned char *buf, int num) |
484 | { | 484 | { |
485 | int ret, err; | 485 | int ret; |
486 | 486 | ||
487 | ret = RAND_bytes(buf, num); | 487 | ret = RAND_bytes(buf, num); |
488 | if (ret == 0) | 488 | if (ret == 0) |
489 | { | 489 | { |
490 | err = ERR_peek_error(); | 490 | long err = ERR_peek_error(); |
491 | if (ERR_GET_LIB(err) == ERR_LIB_RAND && | 491 | if (ERR_GET_LIB(err) == ERR_LIB_RAND && |
492 | ERR_GET_REASON(err) == RAND_R_PRNG_NOT_SEEDED) | 492 | ERR_GET_REASON(err) == RAND_R_PRNG_NOT_SEEDED) |
493 | (void)ERR_get_error(); | 493 | (void)ERR_get_error(); |
diff --git a/src/lib/libcrypto/rand/rand.h b/src/lib/libcrypto/rand/rand.h index eb9c8c034d..9c6052733e 100644 --- a/src/lib/libcrypto/rand/rand.h +++ b/src/lib/libcrypto/rand/rand.h | |||
@@ -59,6 +59,8 @@ | |||
59 | #ifndef HEADER_RAND_H | 59 | #ifndef HEADER_RAND_H |
60 | #define HEADER_RAND_H | 60 | #define HEADER_RAND_H |
61 | 61 | ||
62 | #include <stdlib.h> | ||
63 | |||
62 | #ifdef __cplusplus | 64 | #ifdef __cplusplus |
63 | extern "C" { | 65 | extern "C" { |
64 | #endif | 66 | #endif |
@@ -89,7 +91,7 @@ void RAND_seed(const void *buf,int num); | |||
89 | void RAND_add(const void *buf,int num,double entropy); | 91 | void RAND_add(const void *buf,int num,double entropy); |
90 | int RAND_load_file(const char *file,long max_bytes); | 92 | int RAND_load_file(const char *file,long max_bytes); |
91 | int RAND_write_file(const char *file); | 93 | int RAND_write_file(const char *file); |
92 | const char *RAND_file_name(char *file,int num); | 94 | const char *RAND_file_name(char *file,size_t num); |
93 | int RAND_status(void); | 95 | int RAND_status(void); |
94 | int RAND_egd(const char *path); | 96 | int RAND_egd(const char *path); |
95 | int RAND_egd_bytes(const char *path,int bytes); | 97 | int RAND_egd_bytes(const char *path,int bytes); |
diff --git a/src/lib/libcrypto/rand/rand_egd.c b/src/lib/libcrypto/rand/rand_egd.c index 02a0d86fa3..79b5e6fa57 100644 --- a/src/lib/libcrypto/rand/rand_egd.c +++ b/src/lib/libcrypto/rand/rand_egd.c | |||
@@ -74,7 +74,14 @@ int RAND_egd_bytes(const char *path,int bytes) | |||
74 | #include OPENSSL_UNISTD | 74 | #include OPENSSL_UNISTD |
75 | #include <sys/types.h> | 75 | #include <sys/types.h> |
76 | #include <sys/socket.h> | 76 | #include <sys/socket.h> |
77 | #ifndef NO_SYS_UN_H | ||
77 | #include <sys/un.h> | 78 | #include <sys/un.h> |
79 | #else | ||
80 | struct sockaddr_un { | ||
81 | short sun_family; /* AF_UNIX */ | ||
82 | char sun_path[108]; /* path name (gag) */ | ||
83 | }; | ||
84 | #endif /* NO_SYS_UN_H */ | ||
78 | #include <string.h> | 85 | #include <string.h> |
79 | 86 | ||
80 | #ifndef offsetof | 87 | #ifndef offsetof |
diff --git a/src/lib/libcrypto/rand/rand_win.c b/src/lib/libcrypto/rand/rand_win.c index 9f2dcff9a9..3d137badd0 100644 --- a/src/lib/libcrypto/rand/rand_win.c +++ b/src/lib/libcrypto/rand/rand_win.c | |||
@@ -570,14 +570,15 @@ static void readtimer(void) | |||
570 | DWORD w; | 570 | DWORD w; |
571 | LARGE_INTEGER l; | 571 | LARGE_INTEGER l; |
572 | static int have_perfc = 1; | 572 | static int have_perfc = 1; |
573 | #ifndef __GNUC__ | 573 | #ifdef _MSC_VER |
574 | static int have_tsc = 1; | 574 | static int have_tsc = 1; |
575 | DWORD cyclecount; | 575 | DWORD cyclecount; |
576 | 576 | ||
577 | if (have_tsc) { | 577 | if (have_tsc) { |
578 | __try { | 578 | __try { |
579 | __asm { | 579 | __asm { |
580 | rdtsc | 580 | _emit 0x0f |
581 | _emit 0x31 | ||
581 | mov cyclecount, eax | 582 | mov cyclecount, eax |
582 | } | 583 | } |
583 | RAND_add(&cyclecount, sizeof(cyclecount), 1); | 584 | RAND_add(&cyclecount, sizeof(cyclecount), 1); |
@@ -725,8 +726,9 @@ int RAND_poll(void) | |||
725 | 726 | ||
726 | #ifdef DEVRANDOM | 727 | #ifdef DEVRANDOM |
727 | return 1; | 728 | return 1; |
728 | #endif | 729 | #else |
729 | return 0; | 730 | return 0; |
731 | #endif | ||
730 | } | 732 | } |
731 | 733 | ||
732 | #endif | 734 | #endif |
diff --git a/src/lib/libcrypto/rand/randfile.c b/src/lib/libcrypto/rand/randfile.c index 663a36cb70..f4376cf8cc 100644 --- a/src/lib/libcrypto/rand/randfile.c +++ b/src/lib/libcrypto/rand/randfile.c | |||
@@ -73,7 +73,7 @@ | |||
73 | # include <sys/stat.h> | 73 | # include <sys/stat.h> |
74 | #endif | 74 | #endif |
75 | 75 | ||
76 | #include <openssl/e_os.h> | 76 | #include "openssl/e_os.h" |
77 | #include <openssl/crypto.h> | 77 | #include <openssl/crypto.h> |
78 | #include <openssl/rand.h> | 78 | #include <openssl/rand.h> |
79 | 79 | ||
@@ -83,6 +83,9 @@ | |||
83 | 83 | ||
84 | /* #define RFILE ".rnd" - defined in ../../e_os.h */ | 84 | /* #define RFILE ".rnd" - defined in ../../e_os.h */ |
85 | 85 | ||
86 | /* Note that these functions are intended for seed files only. | ||
87 | * Entropy devices and EGD sockets are handled in rand_unix.c */ | ||
88 | |||
86 | int RAND_load_file(const char *file, long bytes) | 89 | int RAND_load_file(const char *file, long bytes) |
87 | { | 90 | { |
88 | /* If bytes >= 0, read up to 'bytes' bytes. | 91 | /* If bytes >= 0, read up to 'bytes' bytes. |
@@ -213,7 +216,7 @@ err: | |||
213 | return (rand_err ? -1 : ret); | 216 | return (rand_err ? -1 : ret); |
214 | } | 217 | } |
215 | 218 | ||
216 | const char *RAND_file_name(char *buf, int size) | 219 | const char *RAND_file_name(char *buf, size_t size) |
217 | { | 220 | { |
218 | char *s = NULL; | 221 | char *s = NULL; |
219 | char *ret=NULL; | 222 | char *ret=NULL; |
@@ -239,6 +242,8 @@ const char *RAND_file_name(char *buf, int size) | |||
239 | strlcat(buf,RFILE,size); | 242 | strlcat(buf,RFILE,size); |
240 | ret=buf; | 243 | ret=buf; |
241 | } | 244 | } |
245 | else | ||
246 | buf[0] = '\0'; /* no file name */ | ||
242 | } | 247 | } |
243 | 248 | ||
244 | #ifdef DEVRANDOM | 249 | #ifdef DEVRANDOM |
@@ -257,3 +262,4 @@ const char *RAND_file_name(char *buf, int size) | |||
257 | #endif | 262 | #endif |
258 | return(ret); | 263 | return(ret); |
259 | } | 264 | } |
265 | |||
diff --git a/src/lib/libcrypto/rc2/Makefile.ssl b/src/lib/libcrypto/rc2/Makefile.ssl index 9e94051cd7..39813d68be 100644 --- a/src/lib/libcrypto/rc2/Makefile.ssl +++ b/src/lib/libcrypto/rc2/Makefile.ssl | |||
@@ -39,7 +39,8 @@ all: lib | |||
39 | 39 | ||
40 | lib: $(LIBOBJ) | 40 | lib: $(LIBOBJ) |
41 | $(AR) $(LIB) $(LIBOBJ) | 41 | $(AR) $(LIB) $(LIBOBJ) |
42 | $(RANLIB) $(LIB) | 42 | @echo You may get an error following this line. Please ignore. |
43 | - $(RANLIB) $(LIB) | ||
43 | @touch lib | 44 | @touch lib |
44 | 45 | ||
45 | files: | 46 | files: |
diff --git a/src/lib/libcrypto/rc4/Makefile.ssl b/src/lib/libcrypto/rc4/Makefile.ssl index 8d2a795c22..e75858d3b9 100644 --- a/src/lib/libcrypto/rc4/Makefile.ssl +++ b/src/lib/libcrypto/rc4/Makefile.ssl | |||
@@ -47,7 +47,8 @@ all: lib | |||
47 | 47 | ||
48 | lib: $(LIBOBJ) | 48 | lib: $(LIBOBJ) |
49 | $(AR) $(LIB) $(LIBOBJ) | 49 | $(AR) $(LIB) $(LIBOBJ) |
50 | $(RANLIB) $(LIB) | 50 | @echo You may get an error following this line. Please ignore. |
51 | - $(RANLIB) $(LIB) | ||
51 | @touch lib | 52 | @touch lib |
52 | 53 | ||
53 | # elf | 54 | # elf |
diff --git a/src/lib/libcrypto/rc5/Makefile.ssl b/src/lib/libcrypto/rc5/Makefile.ssl index 5a54a162ba..c8ee124776 100644 --- a/src/lib/libcrypto/rc5/Makefile.ssl +++ b/src/lib/libcrypto/rc5/Makefile.ssl | |||
@@ -44,7 +44,8 @@ all: lib | |||
44 | 44 | ||
45 | lib: $(LIBOBJ) | 45 | lib: $(LIBOBJ) |
46 | $(AR) $(LIB) $(LIBOBJ) | 46 | $(AR) $(LIB) $(LIBOBJ) |
47 | $(RANLIB) $(LIB) | 47 | @echo You may get an error following this line. Please ignore. |
48 | - $(RANLIB) $(LIB) | ||
48 | @touch lib | 49 | @touch lib |
49 | 50 | ||
50 | # elf | 51 | # elf |
diff --git a/src/lib/libcrypto/ripemd/Makefile.ssl b/src/lib/libcrypto/ripemd/Makefile.ssl index de01a953ec..1550c32ca1 100644 --- a/src/lib/libcrypto/ripemd/Makefile.ssl +++ b/src/lib/libcrypto/ripemd/Makefile.ssl | |||
@@ -42,7 +42,8 @@ all: lib | |||
42 | 42 | ||
43 | lib: $(LIBOBJ) | 43 | lib: $(LIBOBJ) |
44 | $(AR) $(LIB) $(LIBOBJ) | 44 | $(AR) $(LIB) $(LIBOBJ) |
45 | $(RANLIB) $(LIB) | 45 | @echo You may get an error following this line. Please ignore. |
46 | - $(RANLIB) $(LIB) | ||
46 | @touch lib | 47 | @touch lib |
47 | 48 | ||
48 | # elf | 49 | # elf |
diff --git a/src/lib/libcrypto/rsa/Makefile.ssl b/src/lib/libcrypto/rsa/Makefile.ssl index c159eedafe..2bee181d4e 100644 --- a/src/lib/libcrypto/rsa/Makefile.ssl +++ b/src/lib/libcrypto/rsa/Makefile.ssl | |||
@@ -41,7 +41,8 @@ all: lib | |||
41 | 41 | ||
42 | lib: $(LIBOBJ) | 42 | lib: $(LIBOBJ) |
43 | $(AR) $(LIB) $(LIBOBJ) | 43 | $(AR) $(LIB) $(LIBOBJ) |
44 | $(RANLIB) $(LIB) | 44 | @echo You may get an error following this line. Please ignore. |
45 | - $(RANLIB) $(LIB) | ||
45 | @touch lib | 46 | @touch lib |
46 | 47 | ||
47 | files: | 48 | files: |
diff --git a/src/lib/libcrypto/rsa/rsa_eay.c b/src/lib/libcrypto/rsa/rsa_eay.c index ccaa62b239..cde5ca27d5 100644 --- a/src/lib/libcrypto/rsa/rsa_eay.c +++ b/src/lib/libcrypto/rsa/rsa_eay.c | |||
@@ -141,9 +141,26 @@ static int RSA_eay_public_encrypt(int flen, unsigned char *from, | |||
141 | 141 | ||
142 | if ((rsa->_method_mod_n == NULL) && (rsa->flags & RSA_FLAG_CACHE_PUBLIC)) | 142 | if ((rsa->_method_mod_n == NULL) && (rsa->flags & RSA_FLAG_CACHE_PUBLIC)) |
143 | { | 143 | { |
144 | if ((rsa->_method_mod_n=BN_MONT_CTX_new()) != NULL) | 144 | BN_MONT_CTX* bn_mont_ctx; |
145 | if (!BN_MONT_CTX_set(rsa->_method_mod_n,rsa->n,ctx)) | 145 | if ((bn_mont_ctx=BN_MONT_CTX_new()) == NULL) |
146 | goto err; | 146 | goto err; |
147 | if (!BN_MONT_CTX_set(bn_mont_ctx,rsa->n,ctx)) | ||
148 | { | ||
149 | BN_MONT_CTX_free(bn_mont_ctx); | ||
150 | goto err; | ||
151 | } | ||
152 | if (rsa->_method_mod_n == NULL) /* other thread may have finished first */ | ||
153 | { | ||
154 | CRYPTO_w_lock(CRYPTO_LOCK_RSA); | ||
155 | if (rsa->_method_mod_n == NULL) | ||
156 | { | ||
157 | rsa->_method_mod_n = bn_mont_ctx; | ||
158 | bn_mont_ctx = NULL; | ||
159 | } | ||
160 | CRYPTO_w_unlock(CRYPTO_LOCK_RSA); | ||
161 | } | ||
162 | if (bn_mont_ctx) | ||
163 | BN_MONT_CTX_free(bn_mont_ctx); | ||
147 | } | 164 | } |
148 | 165 | ||
149 | if (!meth->bn_mod_exp(&ret,&f,rsa->e,rsa->n,ctx, | 166 | if (!meth->bn_mod_exp(&ret,&f,rsa->e,rsa->n,ctx, |
@@ -378,9 +395,26 @@ static int RSA_eay_public_decrypt(int flen, unsigned char *from, | |||
378 | /* do the decrypt */ | 395 | /* do the decrypt */ |
379 | if ((rsa->_method_mod_n == NULL) && (rsa->flags & RSA_FLAG_CACHE_PUBLIC)) | 396 | if ((rsa->_method_mod_n == NULL) && (rsa->flags & RSA_FLAG_CACHE_PUBLIC)) |
380 | { | 397 | { |
381 | if ((rsa->_method_mod_n=BN_MONT_CTX_new()) != NULL) | 398 | BN_MONT_CTX* bn_mont_ctx; |
382 | if (!BN_MONT_CTX_set(rsa->_method_mod_n,rsa->n,ctx)) | 399 | if ((bn_mont_ctx=BN_MONT_CTX_new()) == NULL) |
383 | goto err; | 400 | goto err; |
401 | if (!BN_MONT_CTX_set(bn_mont_ctx,rsa->n,ctx)) | ||
402 | { | ||
403 | BN_MONT_CTX_free(bn_mont_ctx); | ||
404 | goto err; | ||
405 | } | ||
406 | if (rsa->_method_mod_n == NULL) /* other thread may have finished first */ | ||
407 | { | ||
408 | CRYPTO_w_lock(CRYPTO_LOCK_RSA); | ||
409 | if (rsa->_method_mod_n == NULL) | ||
410 | { | ||
411 | rsa->_method_mod_n = bn_mont_ctx; | ||
412 | bn_mont_ctx = NULL; | ||
413 | } | ||
414 | CRYPTO_w_unlock(CRYPTO_LOCK_RSA); | ||
415 | } | ||
416 | if (bn_mont_ctx) | ||
417 | BN_MONT_CTX_free(bn_mont_ctx); | ||
384 | } | 418 | } |
385 | 419 | ||
386 | if (!meth->bn_mod_exp(&ret,&f,rsa->e,rsa->n,ctx, | 420 | if (!meth->bn_mod_exp(&ret,&f,rsa->e,rsa->n,ctx, |
@@ -433,20 +467,53 @@ static int RSA_eay_mod_exp(BIGNUM *r0, BIGNUM *I, RSA *rsa) | |||
433 | { | 467 | { |
434 | if (rsa->_method_mod_p == NULL) | 468 | if (rsa->_method_mod_p == NULL) |
435 | { | 469 | { |
436 | if ((rsa->_method_mod_p=BN_MONT_CTX_new()) != NULL) | 470 | BN_MONT_CTX* bn_mont_ctx; |
437 | if (!BN_MONT_CTX_set(rsa->_method_mod_p,rsa->p, | 471 | if ((bn_mont_ctx=BN_MONT_CTX_new()) == NULL) |
438 | ctx)) | 472 | goto err; |
439 | goto err; | 473 | if (!BN_MONT_CTX_set(bn_mont_ctx,rsa->p,ctx)) |
474 | { | ||
475 | BN_MONT_CTX_free(bn_mont_ctx); | ||
476 | goto err; | ||
477 | } | ||
478 | if (rsa->_method_mod_p == NULL) /* other thread may have finished first */ | ||
479 | { | ||
480 | CRYPTO_w_lock(CRYPTO_LOCK_RSA); | ||
481 | if (rsa->_method_mod_p == NULL) | ||
482 | { | ||
483 | rsa->_method_mod_p = bn_mont_ctx; | ||
484 | bn_mont_ctx = NULL; | ||
485 | } | ||
486 | CRYPTO_w_unlock(CRYPTO_LOCK_RSA); | ||
487 | } | ||
488 | if (bn_mont_ctx) | ||
489 | BN_MONT_CTX_free(bn_mont_ctx); | ||
440 | } | 490 | } |
491 | |||
441 | if (rsa->_method_mod_q == NULL) | 492 | if (rsa->_method_mod_q == NULL) |
442 | { | 493 | { |
443 | if ((rsa->_method_mod_q=BN_MONT_CTX_new()) != NULL) | 494 | BN_MONT_CTX* bn_mont_ctx; |
444 | if (!BN_MONT_CTX_set(rsa->_method_mod_q,rsa->q, | 495 | if ((bn_mont_ctx=BN_MONT_CTX_new()) == NULL) |
445 | ctx)) | 496 | goto err; |
446 | goto err; | 497 | if (!BN_MONT_CTX_set(bn_mont_ctx,rsa->q,ctx)) |
498 | { | ||
499 | BN_MONT_CTX_free(bn_mont_ctx); | ||
500 | goto err; | ||
501 | } | ||
502 | if (rsa->_method_mod_q == NULL) /* other thread may have finished first */ | ||
503 | { | ||
504 | CRYPTO_w_lock(CRYPTO_LOCK_RSA); | ||
505 | if (rsa->_method_mod_q == NULL) | ||
506 | { | ||
507 | rsa->_method_mod_q = bn_mont_ctx; | ||
508 | bn_mont_ctx = NULL; | ||
509 | } | ||
510 | CRYPTO_w_unlock(CRYPTO_LOCK_RSA); | ||
511 | } | ||
512 | if (bn_mont_ctx) | ||
513 | BN_MONT_CTX_free(bn_mont_ctx); | ||
447 | } | 514 | } |
448 | } | 515 | } |
449 | 516 | ||
450 | if (!BN_mod(&r1,I,rsa->q,ctx)) goto err; | 517 | if (!BN_mod(&r1,I,rsa->q,ctx)) goto err; |
451 | if (!meth->bn_mod_exp(&m1,&r1,rsa->dmq1,rsa->q,ctx, | 518 | if (!meth->bn_mod_exp(&m1,&r1,rsa->dmq1,rsa->q,ctx, |
452 | rsa->_method_mod_q)) goto err; | 519 | rsa->_method_mod_q)) goto err; |
diff --git a/src/lib/libcrypto/rsa/rsa_lib.c b/src/lib/libcrypto/rsa/rsa_lib.c index 5e1e8fcdf3..94395cc22c 100644 --- a/src/lib/libcrypto/rsa/rsa_lib.c +++ b/src/lib/libcrypto/rsa/rsa_lib.c | |||
@@ -191,13 +191,13 @@ RSA *RSA_new_method(ENGINE *engine) | |||
191 | ret->blinding=NULL; | 191 | ret->blinding=NULL; |
192 | ret->bignum_data=NULL; | 192 | ret->bignum_data=NULL; |
193 | ret->flags=meth->flags; | 193 | ret->flags=meth->flags; |
194 | CRYPTO_new_ex_data(rsa_meth,ret,&ret->ex_data); | ||
194 | if ((meth->init != NULL) && !meth->init(ret)) | 195 | if ((meth->init != NULL) && !meth->init(ret)) |
195 | { | 196 | { |
197 | CRYPTO_free_ex_data(rsa_meth,ret,&ret->ex_data); | ||
196 | OPENSSL_free(ret); | 198 | OPENSSL_free(ret); |
197 | ret=NULL; | 199 | ret=NULL; |
198 | } | 200 | } |
199 | else | ||
200 | CRYPTO_new_ex_data(rsa_meth,ret,&ret->ex_data); | ||
201 | return(ret); | 201 | return(ret); |
202 | } | 202 | } |
203 | 203 | ||
@@ -221,13 +221,13 @@ void RSA_free(RSA *r) | |||
221 | } | 221 | } |
222 | #endif | 222 | #endif |
223 | 223 | ||
224 | CRYPTO_free_ex_data(rsa_meth,r,&r->ex_data); | ||
225 | |||
226 | meth = ENGINE_get_RSA(r->engine); | 224 | meth = ENGINE_get_RSA(r->engine); |
227 | if (meth->finish != NULL) | 225 | if (meth->finish != NULL) |
228 | meth->finish(r); | 226 | meth->finish(r); |
229 | ENGINE_finish(r->engine); | 227 | ENGINE_finish(r->engine); |
230 | 228 | ||
229 | CRYPTO_free_ex_data(rsa_meth,r,&r->ex_data); | ||
230 | |||
231 | if (r->n != NULL) BN_clear_free(r->n); | 231 | if (r->n != NULL) BN_clear_free(r->n); |
232 | if (r->e != NULL) BN_clear_free(r->e); | 232 | if (r->e != NULL) BN_clear_free(r->e); |
233 | if (r->d != NULL) BN_clear_free(r->d); | 233 | if (r->d != NULL) BN_clear_free(r->d); |
@@ -325,7 +325,7 @@ int RSA_blinding_on(RSA *rsa, BN_CTX *p_ctx) | |||
325 | 325 | ||
326 | BN_CTX_start(ctx); | 326 | BN_CTX_start(ctx); |
327 | A = BN_CTX_get(ctx); | 327 | A = BN_CTX_get(ctx); |
328 | if (!BN_rand(A,BN_num_bits(rsa->n)-1,1,0)) goto err; | 328 | if (!BN_rand_range(A,rsa->n)) goto err; |
329 | if ((Ai=BN_mod_inverse(NULL,A,rsa->n,ctx)) == NULL) goto err; | 329 | if ((Ai=BN_mod_inverse(NULL,A,rsa->n,ctx)) == NULL) goto err; |
330 | 330 | ||
331 | if (!ENGINE_get_RSA(rsa->engine)->bn_mod_exp(A,A, | 331 | if (!ENGINE_get_RSA(rsa->engine)->bn_mod_exp(A,A, |
diff --git a/src/lib/libcrypto/sha/Makefile.ssl b/src/lib/libcrypto/sha/Makefile.ssl index 72acd8f046..790e572fa2 100644 --- a/src/lib/libcrypto/sha/Makefile.ssl +++ b/src/lib/libcrypto/sha/Makefile.ssl | |||
@@ -42,7 +42,8 @@ all: lib | |||
42 | 42 | ||
43 | lib: $(LIBOBJ) | 43 | lib: $(LIBOBJ) |
44 | $(AR) $(LIB) $(LIBOBJ) | 44 | $(AR) $(LIB) $(LIBOBJ) |
45 | $(RANLIB) $(LIB) | 45 | @echo You may get an error following this line. Please ignore. |
46 | - $(RANLIB) $(LIB) | ||
46 | @touch lib | 47 | @touch lib |
47 | 48 | ||
48 | # elf | 49 | # elf |
diff --git a/src/lib/libcrypto/sha/asm/sha1-586.pl b/src/lib/libcrypto/sha/asm/sha1-586.pl index 09df993ecd..fe51fd0794 100644 --- a/src/lib/libcrypto/sha/asm/sha1-586.pl +++ b/src/lib/libcrypto/sha/asm/sha1-586.pl | |||
@@ -317,7 +317,7 @@ sub BODY_60_79 | |||
317 | 317 | ||
318 | sub sha1_block_host | 318 | sub sha1_block_host |
319 | { | 319 | { |
320 | local($name)=@_; | 320 | local($name, $sclabel)=@_; |
321 | 321 | ||
322 | &function_begin_B($name,""); | 322 | &function_begin_B($name,""); |
323 | 323 | ||
@@ -352,7 +352,7 @@ sub sha1_block_host | |||
352 | &mov(&swtmp($i+0),$A); | 352 | &mov(&swtmp($i+0),$A); |
353 | &mov(&swtmp($i+1),$B); | 353 | &mov(&swtmp($i+1),$B); |
354 | } | 354 | } |
355 | &jmp(&label("shortcut")); | 355 | &jmp($sclabel); |
356 | &function_end_B($name); | 356 | &function_end_B($name); |
357 | } | 357 | } |
358 | 358 | ||
@@ -529,10 +529,12 @@ sub sha1_block_data | |||
529 | &pop("esi"); | 529 | &pop("esi"); |
530 | &ret(); | 530 | &ret(); |
531 | 531 | ||
532 | # it has to reside within sha1_block_asm_host_order body | 532 | # keep a note of shortcut label so it can be used outside |
533 | # because it calls &jmp(&label("shortcut")); | 533 | # block. |
534 | &sha1_block_host("sha1_block_asm_host_order"); | 534 | my $sclabel = &label("shortcut"); |
535 | 535 | ||
536 | &function_end_B($name); | 536 | &function_end_B($name); |
537 | # Putting this here avoids problems with MASM in debugging mode | ||
538 | &sha1_block_host("sha1_block_asm_host_order", $sclabel); | ||
537 | } | 539 | } |
538 | 540 | ||
diff --git a/src/lib/libcrypto/stack/Makefile.ssl b/src/lib/libcrypto/stack/Makefile.ssl index 86ed928750..c916fd5451 100644 --- a/src/lib/libcrypto/stack/Makefile.ssl +++ b/src/lib/libcrypto/stack/Makefile.ssl | |||
@@ -39,7 +39,8 @@ all: lib | |||
39 | 39 | ||
40 | lib: $(LIBOBJ) | 40 | lib: $(LIBOBJ) |
41 | $(AR) $(LIB) $(LIBOBJ) | 41 | $(AR) $(LIB) $(LIBOBJ) |
42 | $(RANLIB) $(LIB) | 42 | @echo You may get an error following this line. Please ignore. |
43 | - $(RANLIB) $(LIB) | ||
43 | @touch lib | 44 | @touch lib |
44 | 45 | ||
45 | files: | 46 | files: |
diff --git a/src/lib/libcrypto/txt_db/Makefile.ssl b/src/lib/libcrypto/txt_db/Makefile.ssl index cb54d53323..ee054e91f2 100644 --- a/src/lib/libcrypto/txt_db/Makefile.ssl +++ b/src/lib/libcrypto/txt_db/Makefile.ssl | |||
@@ -39,7 +39,8 @@ all: lib | |||
39 | 39 | ||
40 | lib: $(LIBOBJ) | 40 | lib: $(LIBOBJ) |
41 | $(AR) $(LIB) $(LIBOBJ) | 41 | $(AR) $(LIB) $(LIBOBJ) |
42 | $(RANLIB) $(LIB) | 42 | @echo You may get an error following this line. Please ignore. |
43 | - $(RANLIB) $(LIB) | ||
43 | @touch lib | 44 | @touch lib |
44 | 45 | ||
45 | files: | 46 | files: |
diff --git a/src/lib/libcrypto/uid.c b/src/lib/libcrypto/uid.c new file mode 100644 index 0000000000..b5b61b76d4 --- /dev/null +++ b/src/lib/libcrypto/uid.c | |||
@@ -0,0 +1,88 @@ | |||
1 | /* crypto/uid.c */ | ||
2 | /* ==================================================================== | ||
3 | * Copyright (c) 2001 The OpenSSL Project. All rights reserved. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions | ||
7 | * are met: | ||
8 | * | ||
9 | * 1. Redistributions of source code must retain the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer. | ||
11 | * | ||
12 | * 2. Redistributions in binary form must reproduce the above copyright | ||
13 | * notice, this list of conditions and the following disclaimer in | ||
14 | * the documentation and/or other materials provided with the | ||
15 | * distribution. | ||
16 | * | ||
17 | * 3. All advertising materials mentioning features or use of this | ||
18 | * software must display the following acknowledgment: | ||
19 | * "This product includes software developed by the OpenSSL Project | ||
20 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" | ||
21 | * | ||
22 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
23 | * endorse or promote products derived from this software without | ||
24 | * prior written permission. For written permission, please contact | ||
25 | * licensing@OpenSSL.org. | ||
26 | * | ||
27 | * 5. Products derived from this software may not be called "OpenSSL" | ||
28 | * nor may "OpenSSL" appear in their names without prior written | ||
29 | * permission of the OpenSSL Project. | ||
30 | * | ||
31 | * 6. Redistributions of any form whatsoever must retain the following | ||
32 | * acknowledgment: | ||
33 | * "This product includes software developed by the OpenSSL Project | ||
34 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" | ||
35 | * | ||
36 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
37 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
38 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
39 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
40 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
41 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
42 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
43 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
44 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
45 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
46 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
47 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
48 | * ==================================================================== | ||
49 | * | ||
50 | * This product includes cryptographic software written by Eric Young | ||
51 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
52 | * Hudson (tjh@cryptsoft.com). | ||
53 | * | ||
54 | */ | ||
55 | |||
56 | #include <openssl/crypto.h> | ||
57 | |||
58 | #if defined(__OpenBSD__) || (defined(__FreeBSD__) && __FreeBSD__ > 2) | ||
59 | |||
60 | #include <unistd.h> | ||
61 | |||
62 | int OPENSSL_issetugid(void) | ||
63 | { | ||
64 | return issetugid(); | ||
65 | } | ||
66 | |||
67 | #elif defined(WIN32) | ||
68 | |||
69 | int OPENSSL_issetugid(void) | ||
70 | { | ||
71 | return 0; | ||
72 | } | ||
73 | |||
74 | #else | ||
75 | |||
76 | #include <unistd.h> | ||
77 | #include <sys/types.h> | ||
78 | |||
79 | int OPENSSL_issetugid(void) | ||
80 | { | ||
81 | if (getuid() != geteuid()) return 1; | ||
82 | if (getgid() != getegid()) return 1; | ||
83 | return 0; | ||
84 | } | ||
85 | #endif | ||
86 | |||
87 | |||
88 | |||
diff --git a/src/lib/libcrypto/util/clean-depend.pl b/src/lib/libcrypto/util/clean-depend.pl index af676af751..0193e726fe 100644 --- a/src/lib/libcrypto/util/clean-depend.pl +++ b/src/lib/libcrypto/util/clean-depend.pl | |||
@@ -15,8 +15,8 @@ while(<STDIN>) { | |||
15 | my ($file,$deps)=/^(.*): (.*)$/; | 15 | my ($file,$deps)=/^(.*): (.*)$/; |
16 | next if !defined $deps; | 16 | next if !defined $deps; |
17 | my @deps=split ' ',$deps; | 17 | my @deps=split ' ',$deps; |
18 | @deps=grep(!/^\/usr\/include/,@deps); | 18 | @deps=grep(!/^\//,@deps); |
19 | @deps=grep(!/^\/usr\/lib\/gcc-lib/,@deps); | 19 | @deps=grep(!/^\\$/,@deps); |
20 | push @{$files{$file}},@deps; | 20 | push @{$files{$file}},@deps; |
21 | } | 21 | } |
22 | 22 | ||
diff --git a/src/lib/libcrypto/util/libeay.num b/src/lib/libcrypto/util/libeay.num index e8eebbf50c..84ae840804 100644 --- a/src/lib/libcrypto/util/libeay.num +++ b/src/lib/libcrypto/util/libeay.num | |||
@@ -301,8 +301,8 @@ EVP_des_ede_cfb 308 EXIST::FUNCTION:DES | |||
301 | EVP_des_ede_ofb 309 EXIST::FUNCTION:DES | 301 | EVP_des_ede_ofb 309 EXIST::FUNCTION:DES |
302 | EVP_des_ofb 310 EXIST::FUNCTION:DES | 302 | EVP_des_ofb 310 EXIST::FUNCTION:DES |
303 | EVP_desx_cbc 311 EXIST::FUNCTION:DES | 303 | EVP_desx_cbc 311 EXIST::FUNCTION:DES |
304 | EVP_dss 312 EXIST::FUNCTION:DSA | 304 | EVP_dss 312 EXIST::FUNCTION:DSA,SHA |
305 | EVP_dss1 313 EXIST::FUNCTION:DSA | 305 | EVP_dss1 313 EXIST::FUNCTION:DSA,SHA |
306 | EVP_enc_null 314 EXIST::FUNCTION: | 306 | EVP_enc_null 314 EXIST::FUNCTION: |
307 | EVP_get_cipherbyname 315 EXIST::FUNCTION: | 307 | EVP_get_cipherbyname 315 EXIST::FUNCTION: |
308 | EVP_get_digestbyname 316 EXIST::FUNCTION: | 308 | EVP_get_digestbyname 316 EXIST::FUNCTION: |
@@ -779,7 +779,7 @@ des_ede3_cfb64_encrypt 786 EXIST::FUNCTION:DES | |||
779 | des_ede3_ofb64_encrypt 787 EXIST::FUNCTION:DES | 779 | des_ede3_ofb64_encrypt 787 EXIST::FUNCTION:DES |
780 | des_enc_read 788 EXIST::FUNCTION:DES | 780 | des_enc_read 788 EXIST::FUNCTION:DES |
781 | des_enc_write 789 EXIST::FUNCTION:DES | 781 | des_enc_write 789 EXIST::FUNCTION:DES |
782 | des_encrypt 790 EXIST::FUNCTION:DES | 782 | des_encrypt1 790 EXIST::FUNCTION:DES |
783 | des_encrypt2 791 EXIST::FUNCTION:DES | 783 | des_encrypt2 791 EXIST::FUNCTION:DES |
784 | des_encrypt3 792 EXIST::FUNCTION:DES | 784 | des_encrypt3 792 EXIST::FUNCTION:DES |
785 | des_fcrypt 793 EXIST::FUNCTION:DES | 785 | des_fcrypt 793 EXIST::FUNCTION:DES |
@@ -926,7 +926,7 @@ PKCS7_add_signature 938 EXIST::FUNCTION: | |||
926 | PKCS7_cert_from_signer_info 939 EXIST::FUNCTION: | 926 | PKCS7_cert_from_signer_info 939 EXIST::FUNCTION: |
927 | PKCS7_get_signer_info 940 EXIST::FUNCTION: | 927 | PKCS7_get_signer_info 940 EXIST::FUNCTION: |
928 | EVP_delete_alias 941 NOEXIST::FUNCTION: | 928 | EVP_delete_alias 941 NOEXIST::FUNCTION: |
929 | EVP_mdc2 942 EXIST::FUNCTION: | 929 | EVP_mdc2 942 EXIST::FUNCTION:MDC2 |
930 | PEM_read_bio_RSAPublicKey 943 EXIST::FUNCTION:RSA | 930 | PEM_read_bio_RSAPublicKey 943 EXIST::FUNCTION:RSA |
931 | PEM_write_bio_RSAPublicKey 944 EXIST::FUNCTION:RSA | 931 | PEM_write_bio_RSAPublicKey 944 EXIST::FUNCTION:RSA |
932 | d2i_RSAPublicKey_bio 945 EXIST::FUNCTION:RSA | 932 | d2i_RSAPublicKey_bio 945 EXIST::FUNCTION:RSA |
@@ -1870,61 +1870,64 @@ X509_keyid_set1 2460 EXIST::FUNCTION: | |||
1870 | BIO_next 2461 EXIST::FUNCTION: | 1870 | BIO_next 2461 EXIST::FUNCTION: |
1871 | DSO_METHOD_vms 2462 EXIST::FUNCTION: | 1871 | DSO_METHOD_vms 2462 EXIST::FUNCTION: |
1872 | BIO_f_linebuffer 2463 EXIST:VMS:FUNCTION: | 1872 | BIO_f_linebuffer 2463 EXIST:VMS:FUNCTION: |
1873 | ERR_load_ENGINE_strings 2464 EXIST::FUNCTION: | 1873 | BN_bntest_rand 2464 EXIST::FUNCTION: |
1874 | ENGINE_set_DSA 2465 EXIST::FUNCTION: | 1874 | OPENSSL_issetugid 2465 EXIST::FUNCTION: |
1875 | ENGINE_get_finish_function 2466 EXIST::FUNCTION: | 1875 | BN_rand_range 2466 EXIST::FUNCTION: |
1876 | ENGINE_get_default_RSA 2467 EXIST::FUNCTION: | 1876 | ERR_load_ENGINE_strings 2467 EXIST::FUNCTION: |
1877 | ENGINE_get_BN_mod_exp 2468 EXIST::FUNCTION: | 1877 | ENGINE_set_DSA 2468 EXIST::FUNCTION: |
1878 | DSA_get_default_openssl_method 2469 EXIST::FUNCTION:DSA | 1878 | ENGINE_get_finish_function 2469 EXIST::FUNCTION: |
1879 | ENGINE_set_DH 2470 EXIST::FUNCTION: | 1879 | ENGINE_get_default_RSA 2470 EXIST::FUNCTION: |
1880 | ENGINE_set_default_BN_mod_exp_crt 2471 EXIST:!VMS:FUNCTION: | 1880 | ENGINE_get_BN_mod_exp 2471 EXIST::FUNCTION: |
1881 | ENGINE_set_def_BN_mod_exp_crt 2471 EXIST:VMS:FUNCTION: | 1881 | DSA_get_default_openssl_method 2472 EXIST::FUNCTION:DSA |
1882 | ENGINE_init 2472 EXIST::FUNCTION: | 1882 | ENGINE_set_DH 2473 EXIST::FUNCTION: |
1883 | DH_get_default_openssl_method 2473 EXIST::FUNCTION:DH | 1883 | ENGINE_set_default_BN_mod_exp_crt 2474 EXIST:!VMS:FUNCTION: |
1884 | RSA_set_default_openssl_method 2474 EXIST::FUNCTION:RSA | 1884 | ENGINE_set_def_BN_mod_exp_crt 2474 EXIST:VMS:FUNCTION: |
1885 | ENGINE_finish 2475 EXIST::FUNCTION: | 1885 | ENGINE_init 2475 EXIST::FUNCTION: |
1886 | ENGINE_load_public_key 2476 EXIST::FUNCTION: | 1886 | DH_get_default_openssl_method 2476 EXIST::FUNCTION:DH |
1887 | ENGINE_get_DH 2477 EXIST::FUNCTION: | 1887 | RSA_set_default_openssl_method 2477 EXIST::FUNCTION:RSA |
1888 | ENGINE_ctrl 2478 EXIST::FUNCTION: | 1888 | ENGINE_finish 2478 EXIST::FUNCTION: |
1889 | ENGINE_get_init_function 2479 EXIST::FUNCTION: | 1889 | ENGINE_load_public_key 2479 EXIST::FUNCTION: |
1890 | ENGINE_set_init_function 2480 EXIST::FUNCTION: | 1890 | ENGINE_get_DH 2480 EXIST::FUNCTION: |
1891 | ENGINE_set_default_DSA 2481 EXIST::FUNCTION: | 1891 | ENGINE_ctrl 2481 EXIST::FUNCTION: |
1892 | ENGINE_get_name 2482 EXIST::FUNCTION: | 1892 | ENGINE_get_init_function 2482 EXIST::FUNCTION: |
1893 | ENGINE_get_last 2483 EXIST::FUNCTION: | 1893 | ENGINE_set_init_function 2483 EXIST::FUNCTION: |
1894 | ENGINE_get_prev 2484 EXIST::FUNCTION: | 1894 | ENGINE_set_default_DSA 2484 EXIST::FUNCTION: |
1895 | ENGINE_get_default_DH 2485 EXIST::FUNCTION: | 1895 | ENGINE_get_name 2485 EXIST::FUNCTION: |
1896 | ENGINE_get_RSA 2486 EXIST::FUNCTION: | 1896 | ENGINE_get_last 2486 EXIST::FUNCTION: |
1897 | ENGINE_set_default 2487 EXIST::FUNCTION: | 1897 | ENGINE_get_prev 2487 EXIST::FUNCTION: |
1898 | ENGINE_get_RAND 2488 EXIST::FUNCTION: | 1898 | ENGINE_get_default_DH 2488 EXIST::FUNCTION: |
1899 | ENGINE_get_first 2489 EXIST::FUNCTION: | 1899 | ENGINE_get_RSA 2489 EXIST::FUNCTION: |
1900 | ENGINE_by_id 2490 EXIST::FUNCTION: | 1900 | ENGINE_set_default 2490 EXIST::FUNCTION: |
1901 | ENGINE_set_finish_function 2491 EXIST::FUNCTION: | 1901 | ENGINE_get_RAND 2491 EXIST::FUNCTION: |
1902 | ENGINE_get_default_BN_mod_exp_crt 2492 EXIST:!VMS:FUNCTION: | 1902 | ENGINE_get_first 2492 EXIST::FUNCTION: |
1903 | ENGINE_get_def_BN_mod_exp_crt 2492 EXIST:VMS:FUNCTION: | 1903 | ENGINE_by_id 2493 EXIST::FUNCTION: |
1904 | RSA_get_default_openssl_method 2493 EXIST::FUNCTION:RSA | 1904 | ENGINE_set_finish_function 2494 EXIST::FUNCTION: |
1905 | ENGINE_set_RSA 2494 EXIST::FUNCTION: | 1905 | ENGINE_get_default_BN_mod_exp_crt 2495 EXIST:!VMS:FUNCTION: |
1906 | ENGINE_load_private_key 2495 EXIST::FUNCTION: | 1906 | ENGINE_get_def_BN_mod_exp_crt 2495 EXIST:VMS:FUNCTION: |
1907 | ENGINE_set_default_RAND 2496 EXIST::FUNCTION: | 1907 | RSA_get_default_openssl_method 2496 EXIST::FUNCTION:RSA |
1908 | ENGINE_set_BN_mod_exp 2497 EXIST::FUNCTION: | 1908 | ENGINE_set_RSA 2497 EXIST::FUNCTION: |
1909 | ENGINE_remove 2498 EXIST::FUNCTION: | 1909 | ENGINE_load_private_key 2498 EXIST::FUNCTION: |
1910 | ENGINE_free 2499 EXIST::FUNCTION: | 1910 | ENGINE_set_default_RAND 2499 EXIST::FUNCTION: |
1911 | ENGINE_get_BN_mod_exp_crt 2500 EXIST::FUNCTION: | 1911 | ENGINE_set_BN_mod_exp 2500 EXIST::FUNCTION: |
1912 | ENGINE_get_next 2501 EXIST::FUNCTION: | 1912 | ENGINE_remove 2501 EXIST::FUNCTION: |
1913 | ENGINE_set_name 2502 EXIST::FUNCTION: | 1913 | ENGINE_free 2502 EXIST::FUNCTION: |
1914 | ENGINE_get_default_DSA 2503 EXIST::FUNCTION: | 1914 | ENGINE_get_BN_mod_exp_crt 2503 EXIST::FUNCTION: |
1915 | ENGINE_set_default_BN_mod_exp 2504 EXIST::FUNCTION: | 1915 | ENGINE_get_next 2504 EXIST::FUNCTION: |
1916 | ENGINE_set_default_RSA 2505 EXIST::FUNCTION: | 1916 | ENGINE_set_name 2505 EXIST::FUNCTION: |
1917 | ENGINE_get_default_RAND 2506 EXIST::FUNCTION: | 1917 | ENGINE_get_default_DSA 2506 EXIST::FUNCTION: |
1918 | ENGINE_get_default_BN_mod_exp 2507 EXIST::FUNCTION: | 1918 | ENGINE_set_default_BN_mod_exp 2507 EXIST::FUNCTION: |
1919 | ENGINE_set_RAND 2508 EXIST::FUNCTION: | 1919 | ENGINE_set_default_RSA 2508 EXIST::FUNCTION: |
1920 | ENGINE_set_id 2509 EXIST::FUNCTION: | 1920 | ENGINE_get_default_RAND 2509 EXIST::FUNCTION: |
1921 | ENGINE_set_BN_mod_exp_crt 2510 EXIST::FUNCTION: | 1921 | ENGINE_get_default_BN_mod_exp 2510 EXIST::FUNCTION: |
1922 | ENGINE_set_default_DH 2511 EXIST::FUNCTION: | 1922 | ENGINE_set_RAND 2511 EXIST::FUNCTION: |
1923 | ENGINE_new 2512 EXIST::FUNCTION: | 1923 | ENGINE_set_id 2512 EXIST::FUNCTION: |
1924 | ENGINE_get_id 2513 EXIST::FUNCTION: | 1924 | ENGINE_set_BN_mod_exp_crt 2513 EXIST::FUNCTION: |
1925 | DSA_set_default_openssl_method 2514 EXIST::FUNCTION:DSA | 1925 | ENGINE_set_default_DH 2514 EXIST::FUNCTION: |
1926 | ENGINE_add 2515 EXIST::FUNCTION: | 1926 | ENGINE_new 2515 EXIST::FUNCTION: |
1927 | DH_set_default_openssl_method 2516 EXIST::FUNCTION:DH | 1927 | ENGINE_get_id 2516 EXIST::FUNCTION: |
1928 | ENGINE_get_DSA 2517 EXIST::FUNCTION: | 1928 | DSA_set_default_openssl_method 2517 EXIST::FUNCTION:DSA |
1929 | ENGINE_get_ctrl_function 2518 EXIST::FUNCTION: | 1929 | ENGINE_add 2518 EXIST::FUNCTION: |
1930 | ENGINE_set_ctrl_function 2519 EXIST::FUNCTION: | 1930 | DH_set_default_openssl_method 2519 EXIST::FUNCTION:DH |
1931 | ENGINE_get_DSA 2520 EXIST::FUNCTION: | ||
1932 | ENGINE_get_ctrl_function 2521 EXIST::FUNCTION: | ||
1933 | ENGINE_set_ctrl_function 2522 EXIST::FUNCTION: | ||
diff --git a/src/lib/libcrypto/util/mkdef.pl b/src/lib/libcrypto/util/mkdef.pl index cc41a1813e..ba453358cf 100644 --- a/src/lib/libcrypto/util/mkdef.pl +++ b/src/lib/libcrypto/util/mkdef.pl | |||
@@ -119,7 +119,7 @@ foreach (@ARGV, split(/ /, $options)) | |||
119 | elsif (/^no-rc4$/) { $no_rc4=1; } | 119 | elsif (/^no-rc4$/) { $no_rc4=1; } |
120 | elsif (/^no-rc5$/) { $no_rc5=1; } | 120 | elsif (/^no-rc5$/) { $no_rc5=1; } |
121 | elsif (/^no-idea$/) { $no_idea=1; } | 121 | elsif (/^no-idea$/) { $no_idea=1; } |
122 | elsif (/^no-des$/) { $no_des=1; } | 122 | elsif (/^no-des$/) { $no_des=1; $no_mdc2=1; } |
123 | elsif (/^no-bf$/) { $no_bf=1; } | 123 | elsif (/^no-bf$/) { $no_bf=1; } |
124 | elsif (/^no-cast$/) { $no_cast=1; } | 124 | elsif (/^no-cast$/) { $no_cast=1; } |
125 | elsif (/^no-md2$/) { $no_md2=1; } | 125 | elsif (/^no-md2$/) { $no_md2=1; } |
@@ -705,7 +705,8 @@ EOF | |||
705 | } else { | 705 | } else { |
706 | (my $n, my $i) = split /\\/, $nums{$s}; | 706 | (my $n, my $i) = split /\\/, $nums{$s}; |
707 | my %pf = (); | 707 | my %pf = (); |
708 | my @p = split(/,/, ($i =~ /^.*?:(.*?):/,$1)); | 708 | my @p = split(/,/, ($i =~ /^[^:]*:([^:]*):/,$1)); |
709 | my @a = split(/,/, ($i =~ /^[^:]*:[^:]*:[^:]*:([^:]*)/,$1)); | ||
709 | # @p_purged must contain hardware platforms only | 710 | # @p_purged must contain hardware platforms only |
710 | my @p_purged = (); | 711 | my @p_purged = (); |
711 | foreach $ptmp (@p) { | 712 | foreach $ptmp (@p) { |
@@ -727,7 +728,26 @@ EOF | |||
727 | || (!$negatives | 728 | || (!$negatives |
728 | && ($rsaref || !grep(/^RSAREF$/,@p))) | 729 | && ($rsaref || !grep(/^RSAREF$/,@p))) |
729 | || ($negatives | 730 | || ($negatives |
730 | && (!$rsaref || !grep(/^!RSAREF$/,@p))))) { | 731 | && (!$rsaref || !grep(/^!RSAREF$/,@p)))) |
732 | && (!@a || (!$no_rc2 || !grep(/^RC2$/,@a))) | ||
733 | && (!@a || (!$no_rc4 || !grep(/^RC4$/,@a))) | ||
734 | && (!@a || (!$no_rc5 || !grep(/^RC5$/,@a))) | ||
735 | && (!@a || (!$no_idea || !grep(/^IDEA$/,@a))) | ||
736 | && (!@a || (!$no_des || !grep(/^DES$/,@a))) | ||
737 | && (!@a || (!$no_bf || !grep(/^BF$/,@a))) | ||
738 | && (!@a || (!$no_cast || !grep(/^CAST$/,@a))) | ||
739 | && (!@a || (!$no_md2 || !grep(/^MD2$/,@a))) | ||
740 | && (!@a || (!$no_md4 || !grep(/^MD4$/,@a))) | ||
741 | && (!@a || (!$no_md5 || !grep(/^MD5$/,@a))) | ||
742 | && (!@a || (!$no_sha || !grep(/^SHA$/,@a))) | ||
743 | && (!@a || (!$no_ripemd || !grep(/^RIPEMD$/,@a))) | ||
744 | && (!@a || (!$no_mdc2 || !grep(/^MDC2$/,@a))) | ||
745 | && (!@a || (!$no_rsa || !grep(/^RSA$/,@a))) | ||
746 | && (!@a || (!$no_dsa || !grep(/^DSA$/,@a))) | ||
747 | && (!@a || (!$no_dh || !grep(/^DH$/,@a))) | ||
748 | && (!@a || (!$no_hmac || !grep(/^HMAC$/,@a))) | ||
749 | && (!@a || (!$no_fp_api || !grep(/^FP_API$/,@a))) | ||
750 | ) { | ||
731 | printf OUT " %s%-40s@%d\n",($W32)?"":"_",$s,$n; | 751 | printf OUT " %s%-40s@%d\n",($W32)?"":"_",$s,$n; |
732 | # } else { | 752 | # } else { |
733 | # print STDERR "DEBUG: \"$sym\" (@p):", | 753 | # print STDERR "DEBUG: \"$sym\" (@p):", |
diff --git a/src/lib/libcrypto/util/mklink.pl b/src/lib/libcrypto/util/mklink.pl index d7b997ada7..9e9c9a5146 100644 --- a/src/lib/libcrypto/util/mklink.pl +++ b/src/lib/libcrypto/util/mklink.pl | |||
@@ -48,8 +48,13 @@ foreach $dirname (@from_path) { | |||
48 | my $to = join('/', @to_path); | 48 | my $to = join('/', @to_path); |
49 | 49 | ||
50 | my $file; | 50 | my $file; |
51 | $symlink_exists=eval {symlink("",""); 1}; | ||
51 | foreach $file (@files) { | 52 | foreach $file (@files) { |
52 | my $err = ""; | 53 | my $err = ""; |
53 | symlink("$to/$file", "$from/$file") or $err = " [$!]"; | 54 | if ($symlink_exists) { |
55 | symlink("$to/$file", "$from/$file") or $err = " [$!]"; | ||
56 | } else { | ||
57 | system ("cp", "$file", "$from/$file") and $err = " [$!]"; | ||
58 | } | ||
54 | print $file . " => $from/$file$err\n"; | 59 | print $file . " => $from/$file$err\n"; |
55 | } | 60 | } |
diff --git a/src/lib/libcrypto/util/pod2man.pl b/src/lib/libcrypto/util/pod2man.pl index f5ec0767ed..c6b64add60 100644 --- a/src/lib/libcrypto/util/pod2man.pl +++ b/src/lib/libcrypto/util/pod2man.pl | |||
@@ -416,6 +416,8 @@ if ($name ne 'something') { | |||
416 | warn "$0: Improper man page - malformed NAME header in paragraph $. of $ARGV[0]\n" | 416 | warn "$0: Improper man page - malformed NAME header in paragraph $. of $ARGV[0]\n" |
417 | } | 417 | } |
418 | else { | 418 | else { |
419 | $n[0] =~ s/\n/ /; | ||
420 | $n[1] =~ s/\n/ /; | ||
419 | %namedesc = @n; | 421 | %namedesc = @n; |
420 | } | 422 | } |
421 | } | 423 | } |
diff --git a/src/lib/libcrypto/x509/Makefile.ssl b/src/lib/libcrypto/x509/Makefile.ssl index 4619693733..79f09d4f71 100644 --- a/src/lib/libcrypto/x509/Makefile.ssl +++ b/src/lib/libcrypto/x509/Makefile.ssl | |||
@@ -49,7 +49,8 @@ all: lib | |||
49 | 49 | ||
50 | lib: $(LIBOBJ) | 50 | lib: $(LIBOBJ) |
51 | $(AR) $(LIB) $(LIBOBJ) | 51 | $(AR) $(LIB) $(LIBOBJ) |
52 | $(RANLIB) $(LIB) | 52 | @echo You may get an error following this line. Please ignore. |
53 | - $(RANLIB) $(LIB) | ||
53 | @touch lib | 54 | @touch lib |
54 | 55 | ||
55 | files: | 56 | files: |
diff --git a/src/lib/libcrypto/x509/by_dir.c b/src/lib/libcrypto/x509/by_dir.c index cac64a6f40..448bd7e69c 100644 --- a/src/lib/libcrypto/x509/by_dir.c +++ b/src/lib/libcrypto/x509/by_dir.c | |||
@@ -327,7 +327,7 @@ static int get_cert_by_subject(X509_LOOKUP *xl, int type, X509_NAME *name, | |||
327 | * it out again */ | 327 | * it out again */ |
328 | CRYPTO_r_lock(CRYPTO_LOCK_X509_STORE); | 328 | CRYPTO_r_lock(CRYPTO_LOCK_X509_STORE); |
329 | j = sk_X509_OBJECT_find(xl->store_ctx->objs,&stmp); | 329 | j = sk_X509_OBJECT_find(xl->store_ctx->objs,&stmp); |
330 | if(j != -1) tmp=sk_X509_OBJECT_value(xl->store_ctx->objs,i); | 330 | if(j != -1) tmp=sk_X509_OBJECT_value(xl->store_ctx->objs,j); |
331 | else tmp = NULL; | 331 | else tmp = NULL; |
332 | CRYPTO_r_unlock(CRYPTO_LOCK_X509_STORE); | 332 | CRYPTO_r_unlock(CRYPTO_LOCK_X509_STORE); |
333 | 333 | ||
diff --git a/src/lib/libcrypto/x509/x509_cmp.c b/src/lib/libcrypto/x509/x509_cmp.c index b147d573d2..3f9f9b3d47 100644 --- a/src/lib/libcrypto/x509/x509_cmp.c +++ b/src/lib/libcrypto/x509/x509_cmp.c | |||
@@ -199,19 +199,13 @@ unsigned long X509_NAME_hash(X509_NAME *x) | |||
199 | { | 199 | { |
200 | unsigned long ret=0; | 200 | unsigned long ret=0; |
201 | unsigned char md[16]; | 201 | unsigned char md[16]; |
202 | unsigned char str[256],*p,*pp; | ||
203 | int i; | ||
204 | |||
205 | i=i2d_X509_NAME(x,NULL); | ||
206 | if (i > sizeof(str)) | ||
207 | p=OPENSSL_malloc(i); | ||
208 | else | ||
209 | p=str; | ||
210 | 202 | ||
211 | pp=p; | 203 | /* Ensure cached version is up to date */ |
212 | i2d_X509_NAME(x,&pp); | 204 | i2d_X509_NAME(x,NULL); |
213 | MD5((unsigned char *)p,i,&(md[0])); | 205 | /* Use cached encoding directly rather than copying: this should |
214 | if (p != str) OPENSSL_free(p); | 206 | * keep libsafe happy. |
207 | */ | ||
208 | MD5((unsigned char *)x->bytes->data,x->bytes->length,&(md[0])); | ||
215 | 209 | ||
216 | ret=( ((unsigned long)md[0] )|((unsigned long)md[1]<<8L)| | 210 | ret=( ((unsigned long)md[0] )|((unsigned long)md[1]<<8L)| |
217 | ((unsigned long)md[2]<<16L)|((unsigned long)md[3]<<24L) | 211 | ((unsigned long)md[2]<<16L)|((unsigned long)md[3]<<24L) |
diff --git a/src/lib/libcrypto/x509v3/Makefile.ssl b/src/lib/libcrypto/x509v3/Makefile.ssl index f7c3a6ca13..236e13af4e 100644 --- a/src/lib/libcrypto/x509v3/Makefile.ssl +++ b/src/lib/libcrypto/x509v3/Makefile.ssl | |||
@@ -43,7 +43,8 @@ all: lib | |||
43 | 43 | ||
44 | lib: $(LIBOBJ) | 44 | lib: $(LIBOBJ) |
45 | $(AR) $(LIB) $(LIBOBJ) | 45 | $(AR) $(LIB) $(LIBOBJ) |
46 | $(RANLIB) $(LIB) | 46 | @echo You may get an error following this line. Please ignore. |
47 | - $(RANLIB) $(LIB) | ||
47 | @touch lib | 48 | @touch lib |
48 | 49 | ||
49 | files: | 50 | files: |
diff --git a/src/lib/libcrypto/x509v3/v3_alt.c b/src/lib/libcrypto/x509v3/v3_alt.c index 733919f250..94bebcd448 100644 --- a/src/lib/libcrypto/x509v3/v3_alt.c +++ b/src/lib/libcrypto/x509v3/v3_alt.c | |||
@@ -270,7 +270,7 @@ static int copy_email(X509V3_CTX *ctx, STACK_OF(GENERAL_NAME) *gens) | |||
270 | /* Now add any email address(es) to STACK */ | 270 | /* Now add any email address(es) to STACK */ |
271 | i = -1; | 271 | i = -1; |
272 | while((i = X509_NAME_get_index_by_NID(nm, | 272 | while((i = X509_NAME_get_index_by_NID(nm, |
273 | NID_pkcs9_emailAddress, i)) > 0) { | 273 | NID_pkcs9_emailAddress, i)) >= 0) { |
274 | ne = X509_NAME_get_entry(nm, i); | 274 | ne = X509_NAME_get_entry(nm, i); |
275 | email = M_ASN1_IA5STRING_dup(X509_NAME_ENTRY_get_data(ne)); | 275 | email = M_ASN1_IA5STRING_dup(X509_NAME_ENTRY_get_data(ne)); |
276 | if(!email || !(gen = GENERAL_NAME_new())) { | 276 | if(!email || !(gen = GENERAL_NAME_new())) { |
diff --git a/src/lib/libcrypto/x509v3/v3_prn.c b/src/lib/libcrypto/x509v3/v3_prn.c index dbc4fb1f16..14b804c4ad 100644 --- a/src/lib/libcrypto/x509v3/v3_prn.c +++ b/src/lib/libcrypto/x509v3/v3_prn.c | |||
@@ -85,9 +85,16 @@ void X509V3_EXT_val_prn(BIO *out, STACK_OF(CONF_VALUE) *val, int indent, int ml) | |||
85 | else BIO_printf(out, "%s:%s", nval->name, nval->value); | 85 | else BIO_printf(out, "%s:%s", nval->name, nval->value); |
86 | #else | 86 | #else |
87 | else { | 87 | else { |
88 | char tmp[10240]; /* 10k is BIO_printf's limit anyway */ | 88 | int len; |
89 | ascii2ebcdic(tmp, nval->value, strlen(nval->value)+1); | 89 | char *tmp; |
90 | BIO_printf(out, "%s:%s", nval->name, tmp); | 90 | len = strlen(nval->value)+1; |
91 | tmp = OPENSSL_malloc(len); | ||
92 | if (tmp) | ||
93 | { | ||
94 | ascii2ebcdic(tmp, nval->value, len); | ||
95 | BIO_printf(out, "%s:%s", nval->name, tmp); | ||
96 | OPENSSL_free(tmp); | ||
97 | } | ||
91 | } | 98 | } |
92 | #endif | 99 | #endif |
93 | if(ml) BIO_puts(out, "\n"); | 100 | if(ml) BIO_puts(out, "\n"); |
@@ -115,9 +122,16 @@ int X509V3_EXT_print(BIO *out, X509_EXTENSION *ext, int flag, int indent) | |||
115 | BIO_printf(out, "%*s%s", indent, "", value); | 122 | BIO_printf(out, "%*s%s", indent, "", value); |
116 | #else | 123 | #else |
117 | { | 124 | { |
118 | char tmp[10240]; /* 10k is BIO_printf's limit anyway */ | 125 | int len; |
119 | ascii2ebcdic(tmp, value, strlen(value)+1); | 126 | char *tmp; |
120 | BIO_printf(out, "%*s%s", indent, "", tmp); | 127 | len = strlen(value)+1; |
128 | tmp = OPENSSL_malloc(len); | ||
129 | if (tmp) | ||
130 | { | ||
131 | ascii2ebcdic(tmp, value, len); | ||
132 | BIO_printf(out, "%*s%s", indent, "", tmp); | ||
133 | OPENSSL_free(tmp); | ||
134 | } | ||
121 | } | 135 | } |
122 | #endif | 136 | #endif |
123 | } else if(method->i2v) { | 137 | } else if(method->i2v) { |
diff --git a/src/lib/libcrypto/x509v3/v3_purp.c b/src/lib/libcrypto/x509v3/v3_purp.c index 867699b26f..8aecd00e63 100644 --- a/src/lib/libcrypto/x509v3/v3_purp.c +++ b/src/lib/libcrypto/x509v3/v3_purp.c | |||
@@ -362,6 +362,8 @@ static int ca_check(const X509 *x) | |||
362 | else return 0; | 362 | else return 0; |
363 | } else { | 363 | } else { |
364 | if((x->ex_flags & V1_ROOT) == V1_ROOT) return 3; | 364 | if((x->ex_flags & V1_ROOT) == V1_ROOT) return 3; |
365 | /* If key usage present it must have certSign so tolerate it */ | ||
366 | else if (x->ex_flags & EXFLAG_KUSAGE) return 3; | ||
365 | else return 2; | 367 | else return 2; |
366 | } | 368 | } |
367 | } | 369 | } |
@@ -380,7 +382,7 @@ static int check_ssl_ca(const X509 *x) | |||
380 | if(ca_ret != 2) return ca_ret; | 382 | if(ca_ret != 2) return ca_ret; |
381 | else return 0; | 383 | else return 0; |
382 | } | 384 | } |
383 | 385 | ||
384 | 386 | ||
385 | static int check_purpose_ssl_client(const X509_PURPOSE *xp, const X509 *x, int ca) | 387 | static int check_purpose_ssl_client(const X509_PURPOSE *xp, const X509 *x, int ca) |
386 | { | 388 | { |
@@ -446,7 +448,7 @@ static int check_purpose_smime_sign(const X509_PURPOSE *xp, const X509 *x, int c | |||
446 | int ret; | 448 | int ret; |
447 | ret = purpose_smime(x, ca); | 449 | ret = purpose_smime(x, ca); |
448 | if(!ret || ca) return ret; | 450 | if(!ret || ca) return ret; |
449 | if(ku_reject(x, KU_DIGITAL_SIGNATURE)) return 0; | 451 | if(ku_reject(x, KU_DIGITAL_SIGNATURE|KU_NON_REPUDIATION)) return 0; |
450 | return ret; | 452 | return ret; |
451 | } | 453 | } |
452 | 454 | ||