Skip to content

Commit 005d836

Browse files
committed
Merge 'OpenSSL_1_0_2-stable' into 1.0.2-chacha
Fixed issue #5 Cleaned up code of ssl/t1_enc.c a bit Please note that this file still isn't completely up-to-date (merged) with the official 1.0.2 branch
2 parents 991cb5e + 681da86 commit 005d836

File tree

10 files changed

+272
-233
lines changed

10 files changed

+272
-233
lines changed

apps/apps.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2775,7 +2775,7 @@ void print_cert_checks(BIO *bio, X509 *x,
27752775
return;
27762776
if (checkhost) {
27772777
BIO_printf(bio, "Hostname %s does%s match certificate\n",
2778-
checkhost, X509_check_host(x, checkhost, 0, 0, NULL)
2778+
checkhost, X509_check_host(x, checkhost, 0, 0, NULL) == 1
27792779
? "" : " NOT");
27802780
}
27812781

apps/openssl.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -428,10 +428,6 @@ int main(int Argc, char *ARGV[])
428428
if (arg.data != NULL)
429429
OPENSSL_free(arg.data);
430430

431-
if (bio_err != NULL) {
432-
BIO_free(bio_err);
433-
bio_err = NULL;
434-
}
435431
#if defined( OPENSSL_SYS_VMS) && (__INITIAL_POINTER_SIZE == 64)
436432
/* Free any duplicate Argv[] storage. */
437433
if (free_Argv) {
@@ -440,6 +436,10 @@ int main(int Argc, char *ARGV[])
440436
#endif
441437
apps_shutdown();
442438
CRYPTO_mem_leaks(bio_err);
439+
if (bio_err != NULL) {
440+
BIO_free(bio_err);
441+
bio_err = NULL;
442+
}
443443

444444
OPENSSL_EXIT(ret);
445445
}

crypto/conf/conf_def.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,11 @@ static int str_copy(CONF *conf, char *section, char **pto, char *from)
585585
CONFerr(CONF_F_STR_COPY, CONF_R_VARIABLE_HAS_NO_VALUE);
586586
goto err;
587587
}
588-
BUF_MEM_grow_clean(buf, (strlen(p) + buf->length - (e - from)));
588+
if (!BUF_MEM_grow_clean(buf,
589+
(strlen(p) + buf->length - (e - from)))) {
590+
CONFerr(CONF_F_STR_COPY, ERR_R_MALLOC_FAILURE);
591+
goto err;
592+
}
589593
while (*p)
590594
buf->data[to++] = *(p++);
591595

crypto/ex_data.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,8 @@ static void int_free_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad)
500500
EX_CLASS_ITEM *item;
501501
void *ptr;
502502
CRYPTO_EX_DATA_FUNCS **storage = NULL;
503+
if (ex_data == NULL)
504+
return;
503505
if ((item = def_get_class(class_index)) == NULL)
504506
return;
505507
CRYPTO_r_lock(CRYPTO_LOCK_EX_DATA);

crypto/objects/objects.pl

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,9 @@
121121
print OUT <<'EOF';
122122
/* crypto/objects/obj_mac.h */
123123
124-
/* THIS FILE IS GENERATED FROM objects.txt by objects.pl via the
125-
* following command:
126-
* perl objects.pl objects.txt obj_mac.num obj_mac.h
124+
/*
125+
* THIS FILE IS GENERATED FROM objects.txt by objects.pl via the following
126+
* command: perl objects.pl objects.txt obj_mac.num obj_mac.h
127127
*/
128128
129129
/* Copyright (C) 1995-1997 Eric Young ([email protected])
@@ -132,21 +132,21 @@
132132
* This package is an SSL implementation written
133133
* by Eric Young ([email protected]).
134134
* The implementation was written so as to conform with Netscapes SSL.
135-
*
135+
*
136136
* This library is free for commercial and non-commercial use as long as
137137
* the following conditions are aheared to. The following conditions
138138
* apply to all code found in this distribution, be it the RC4, RSA,
139139
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
140140
* included with this distribution is covered by the same copyright terms
141141
* except that the holder is Tim Hudson ([email protected]).
142-
*
142+
*
143143
* Copyright remains Eric Young's, and as such any Copyright notices in
144144
* the code are not to be removed.
145145
* If this package is used in a product, Eric Young should be given attribution
146146
* as the author of the parts of the library used.
147147
* This can be in the form of a textual message at program startup or
148148
* in documentation (online or textual) provided with the package.
149-
*
149+
*
150150
* Redistribution and use in source and binary forms, with or without
151151
* modification, are permitted provided that the following conditions
152152
* are met:
@@ -161,10 +161,10 @@
161161
* Eric Young ([email protected])"
162162
* The word 'cryptographic' can be left out if the rouines from the library
163163
* being used are not cryptographic related :-).
164-
* 4. If you include any Windows specific code (or a derivative thereof) from
164+
* 4. If you include any Windows specific code (or a derivative thereof) from
165165
* the apps directory (application code) you must include an acknowledgement:
166166
* "This product includes software written by Tim Hudson ([email protected])"
167-
*
167+
*
168168
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
169169
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
170170
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -176,28 +176,36 @@
176176
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
177177
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
178178
* SUCH DAMAGE.
179-
*
179+
*
180180
* The licence and distribution terms for any publically available version or
181181
* derivative of this code cannot be changed. i.e. this code cannot simply be
182182
* copied and put under another distribution licence
183183
* [including the GNU Public Licence.]
184184
*/
185185
186-
#define SN_undef "UNDEF"
187-
#define LN_undef "undefined"
188-
#define NID_undef 0
189-
#define OBJ_undef 0L
190-
186+
#define SN_undef "UNDEF"
187+
#define LN_undef "undefined"
188+
#define NID_undef 0
189+
#define OBJ_undef 0L
191190
EOF
192191

192+
sub expand
193+
{
194+
my $string = shift;
195+
196+
1 while $string =~ s/\t+/' ' x (length($&) * 8 - length($`) % 8)/e;
197+
198+
return $string;
199+
}
200+
193201
foreach (sort { $a <=> $b } keys %ordern)
194202
{
195203
$Cname=$ordern{$_};
196-
print OUT "#define SN_",$Cname,"\t\t\"",$sn{$Cname},"\"\n" if $sn{$Cname} ne "";
197-
print OUT "#define LN_",$Cname,"\t\t\"",$ln{$Cname},"\"\n" if $ln{$Cname} ne "";
198-
print OUT "#define NID_",$Cname,"\t\t",$nid{$Cname},"\n" if $nid{$Cname} ne "";
199-
print OUT "#define OBJ_",$Cname,"\t\t",$obj{$Cname},"\n" if $obj{$Cname} ne "";
200204
print OUT "\n";
205+
print OUT expand("#define SN_$Cname\t\t\"$sn{$Cname}\"\n") if $sn{$Cname} ne "";
206+
print OUT expand("#define LN_$Cname\t\t\"$ln{$Cname}\"\n") if $ln{$Cname} ne "";
207+
print OUT expand("#define NID_$Cname\t\t$nid{$Cname}\n") if $nid{$Cname} ne "";
208+
print OUT expand("#define OBJ_$Cname\t\t$obj{$Cname}\n") if $obj{$Cname} ne "";
201209
}
202210

203211
close OUT;

crypto/rand/rand_egd.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ int RAND_egd_bytes(const char *path, int bytes)
113113
#else
114114
# include <openssl/opensslconf.h>
115115
# include OPENSSL_UNISTD
116+
# include <stddef.h>
116117
# include <sys/types.h>
117118
# include <sys/socket.h>
118119
# ifndef NO_SYS_UN_H

crypto/x509v3/v3_utl.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -901,8 +901,13 @@ static int do_check_string(ASN1_STRING *a, int cmp_type, equal_fn equal,
901901
int astrlen;
902902
unsigned char *astr;
903903
astrlen = ASN1_STRING_to_UTF8(&astr, a);
904-
if (astrlen < 0)
904+
if (astrlen < 0) {
905+
/*
906+
* -1 could be an internal malloc failure or a decoding error from
907+
* malformed input; we can't distinguish.
908+
*/
905909
return -1;
910+
}
906911
rv = equal(astr, astrlen, (unsigned char *)b, blen, flags);
907912
if (rv > 0 && peername)
908913
*peername = BUF_strndup((char *)astr, astrlen);

doc/crypto/X509_check_host.pod

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,12 @@ but would not match a peer certificate with a DNS name of
109109
=head1 RETURN VALUES
110110

111111
The functions return 1 for a successful match, 0 for a failed match
112-
and -1 for an internal error: typically a memory allocation failure.
112+
and -1 for an internal error: typically a memory allocation failure
113+
or an ASN.1 decoding error.
113114

114-
X509_check_ip_asc() can also return -2 if the IP address string is malformed.
115+
All functions can also return -2 if the input is malformed. For example,
116+
X509_check_host() returns -2 if the provided B<name> contains embedded
117+
NULs.
115118

116119
=head1 NOTES
117120

engines/ccgost/gost_eng.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ static int bind_gost(ENGINE *e, const char *id)
7676
int ret = 0;
7777
if (id && strcmp(id, engine_gost_id))
7878
return 0;
79+
if (ameth_GostR3410_94) {
80+
printf("GOST engine already loaded\n");
81+
goto end;
82+
}
7983

8084
if (!ENGINE_set_id(e, engine_gost_id)) {
8185
printf("ENGINE_set_id failed\n");

0 commit comments

Comments
 (0)