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