|
|
2502e2 |
From 2c6c9d439b484e1ba9830d8454a34fa4f80fdfe9 Mon Sep 17 00:00:00 2001
|
|
|
2502e2 |
From: Hugo Landau <hlandau@openssl.org>
|
|
|
2502e2 |
Date: Tue, 17 Jan 2023 17:45:42 +0000
|
|
|
2502e2 |
Subject: [PATCH 6/6] CVE-2023-0286: Fix GENERAL_NAME_cmp for x400Address
|
|
|
2502e2 |
(1.1.1)
|
|
|
2502e2 |
|
|
|
2502e2 |
Reviewed-by: Paul Dale <pauli@openssl.org>
|
|
|
2502e2 |
Reviewed-by: Tomas Mraz <tomas@openssl.org>
|
|
|
2502e2 |
---
|
|
|
2502e2 |
CHANGES | 18 +++++++++++++++++-
|
|
|
2502e2 |
crypto/x509v3/v3_genn.c | 2 +-
|
|
|
2502e2 |
include/openssl/x509v3.h | 2 +-
|
|
|
2502e2 |
test/v3nametest.c | 8 ++++++++
|
|
|
2502e2 |
4 files changed, 27 insertions(+), 3 deletions(-)
|
|
|
2502e2 |
|
|
|
2502e2 |
diff --git a/crypto/x509v3/v3_genn.c b/crypto/x509v3/v3_genn.c
|
|
|
2502e2 |
index 87a5eff47c..e54ddc55c9 100644
|
|
|
2502e2 |
--- a/crypto/x509v3/v3_genn.c
|
|
|
2502e2 |
+++ b/crypto/x509v3/v3_genn.c
|
|
|
2502e2 |
@@ -98,7 +98,7 @@ int GENERAL_NAME_cmp(GENERAL_NAME *a, GENERAL_NAME *b)
|
|
|
2502e2 |
return -1;
|
|
|
2502e2 |
switch (a->type) {
|
|
|
2502e2 |
case GEN_X400:
|
|
|
2502e2 |
- result = ASN1_TYPE_cmp(a->d.x400Address, b->d.x400Address);
|
|
|
2502e2 |
+ result = ASN1_STRING_cmp(a->d.x400Address, b->d.x400Address);
|
|
|
2502e2 |
break;
|
|
|
2502e2 |
|
|
|
2502e2 |
case GEN_EDIPARTY:
|
|
|
2502e2 |
diff --git a/include/openssl/x509v3.h b/include/openssl/x509v3.h
|
|
|
2502e2 |
index 90fa3592ce..e61c0f29d4 100644
|
|
|
2502e2 |
--- a/include/openssl/x509v3.h
|
|
|
2502e2 |
+++ b/include/openssl/x509v3.h
|
|
|
2502e2 |
@@ -136,7 +136,7 @@ typedef struct GENERAL_NAME_st {
|
|
|
2502e2 |
OTHERNAME *otherName; /* otherName */
|
|
|
2502e2 |
ASN1_IA5STRING *rfc822Name;
|
|
|
2502e2 |
ASN1_IA5STRING *dNSName;
|
|
|
2502e2 |
- ASN1_TYPE *x400Address;
|
|
|
2502e2 |
+ ASN1_STRING *x400Address;
|
|
|
2502e2 |
X509_NAME *directoryName;
|
|
|
2502e2 |
EDIPARTYNAME *ediPartyName;
|
|
|
2502e2 |
ASN1_IA5STRING *uniformResourceIdentifier;
|
|
|
2502e2 |
diff --git a/test/v3nametest.c b/test/v3nametest.c
|
|
|
2502e2 |
index d1852190b8..37819da8fd 100644
|
|
|
2502e2 |
--- a/test/v3nametest.c
|
|
|
2502e2 |
+++ b/test/v3nametest.c
|
|
|
2502e2 |
@@ -646,6 +646,14 @@ static struct gennamedata {
|
|
|
2502e2 |
0xb7, 0x09, 0x02, 0x02
|
|
|
2502e2 |
},
|
|
|
2502e2 |
15
|
|
|
2502e2 |
+ }, {
|
|
|
2502e2 |
+ /*
|
|
|
2502e2 |
+ * Regression test for CVE-2023-0286.
|
|
|
2502e2 |
+ */
|
|
|
2502e2 |
+ {
|
|
|
2502e2 |
+ 0xa3, 0x00
|
|
|
2502e2 |
+ },
|
|
|
2502e2 |
+ 2
|
|
|
2502e2 |
}
|
|
|
2502e2 |
};
|
|
|
2502e2 |
|
|
|
2502e2 |
--
|
|
|
2502e2 |
2.39.1
|
|
|
2502e2 |
|