|
|
e62613 |
diff -up openssl-1.0.2k/ssl/ssl_cert.c.name-sensitive openssl-1.0.2k/ssl/ssl_cert.c
|
|
|
e62613 |
--- openssl-1.0.2k/ssl/ssl_cert.c.name-sensitive 2017-01-26 14:22:04.000000000 +0100
|
|
|
e62613 |
+++ openssl-1.0.2k/ssl/ssl_cert.c 2018-06-18 13:43:12.452502627 +0200
|
|
|
e62613 |
@@ -855,9 +855,33 @@ int SSL_CTX_add_client_CA(SSL_CTX *ctx,
|
|
|
e62613 |
return (add_client_CA(&(ctx->client_CA), x));
|
|
|
e62613 |
}
|
|
|
e62613 |
|
|
|
e62613 |
-static int xname_cmp(const X509_NAME *const *a, const X509_NAME *const *b)
|
|
|
e62613 |
+static int xname_cmp(const X509_NAME *a, const X509_NAME *b)
|
|
|
e62613 |
{
|
|
|
e62613 |
- return (X509_NAME_cmp(*a, *b));
|
|
|
e62613 |
+ unsigned char *abuf = NULL, *bbuf = NULL;
|
|
|
e62613 |
+ int alen, blen, ret;
|
|
|
e62613 |
+
|
|
|
e62613 |
+ /* X509_NAME_cmp() itself casts away constness in this way, so
|
|
|
e62613 |
+ * assume it's safe:
|
|
|
e62613 |
+ */
|
|
|
e62613 |
+ alen = i2d_X509_NAME((X509_NAME *)a, &abuf);
|
|
|
e62613 |
+ blen = i2d_X509_NAME((X509_NAME *)b, &bbuf);
|
|
|
e62613 |
+
|
|
|
e62613 |
+ if (alen < 0 || blen < 0)
|
|
|
e62613 |
+ ret = -2;
|
|
|
e62613 |
+ else if (alen != blen)
|
|
|
e62613 |
+ ret = alen - blen;
|
|
|
e62613 |
+ else /* alen == blen */
|
|
|
e62613 |
+ ret = memcmp(abuf, bbuf, alen);
|
|
|
e62613 |
+
|
|
|
e62613 |
+ OPENSSL_free(abuf);
|
|
|
e62613 |
+ OPENSSL_free(bbuf);
|
|
|
e62613 |
+
|
|
|
e62613 |
+ return ret;
|
|
|
e62613 |
+}
|
|
|
e62613 |
+
|
|
|
e62613 |
+static int xname_sk_cmp(const X509_NAME *const *a, const X509_NAME *const *b)
|
|
|
e62613 |
+{
|
|
|
e62613 |
+ return xname_cmp(*a, *b);
|
|
|
e62613 |
}
|
|
|
e62613 |
|
|
|
e62613 |
#ifndef OPENSSL_NO_STDIO
|
|
|
e62613 |
@@ -876,7 +900,7 @@ STACK_OF(X509_NAME) *SSL_load_client_CA_
|
|
|
e62613 |
X509_NAME *xn = NULL;
|
|
|
e62613 |
STACK_OF(X509_NAME) *ret = NULL, *sk;
|
|
|
e62613 |
|
|
|
e62613 |
- sk = sk_X509_NAME_new(xname_cmp);
|
|
|
e62613 |
+ sk = sk_X509_NAME_new(xname_sk_cmp);
|
|
|
e62613 |
|
|
|
e62613 |
in = BIO_new(BIO_s_file_internal());
|
|
|
e62613 |
|
|
|
e62613 |
@@ -948,7 +972,7 @@ int SSL_add_file_cert_subjects_to_stack(
|
|
|
e62613 |
int ret = 1;
|
|
|
e62613 |
int (*oldcmp) (const X509_NAME *const *a, const X509_NAME *const *b);
|
|
|
e62613 |
|
|
|
e62613 |
- oldcmp = sk_X509_NAME_set_cmp_func(stack, xname_cmp);
|
|
|
e62613 |
+ oldcmp = sk_X509_NAME_set_cmp_func(stack, xname_sk_cmp);
|
|
|
e62613 |
|
|
|
e62613 |
in = BIO_new(BIO_s_file_internal());
|
|
|
e62613 |
|