]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
RFC 8398: EAI comparison
authorDmitry Belyavskiy <beldmit@gmail.com>
Wed, 21 Aug 2019 15:34:27 +0000 (18:34 +0300)
committerDmitry Belyavskiy <beldmit@gmail.com>
Wed, 26 Aug 2020 11:04:17 +0000 (14:04 +0300)
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9654)

crypto/x509/v3_utl.c

index 9083ed868690a8de2e7c85b84fb910865b8cce62..e31be45e03cad7785955fe78b8407556583c714c 100644 (file)
@@ -878,8 +878,22 @@ static int do_x509_check(X509 *x, const char *chk, size_t chklen,
             ASN1_STRING *cstr;
 
             gen = sk_GENERAL_NAME_value(gens, i);
-            if (gen->type != check_type)
-                continue;
+            if ((gen->type == GEN_OTHERNAME) && (check_type == GEN_EMAIL)) {
+                if (OBJ_obj2nid(gen->d.otherName->type_id) ==
+                    NID_id_on_SmtpUTF8Mailbox) {
+                    san_present = 1;
+                    cstr = gen->d.otherName->value->value.utf8string;
+
+                    /* Positive on success, negative on error! */
+                    if ((rv = do_check_string(cstr, 0, equal, flags,
+                                              chk, chklen, peername)) != 0)
+                        break;
+                } else
+                    continue;
+            } else {
+                if ((gen->type != check_type) && (gen->type != GEN_OTHERNAME))
+                    continue;
+            }
             san_present = 1;
             if (check_type == GEN_EMAIL)
                 cstr = gen->d.rfc822Name;