From: Dmitry Belyavskiy Date: Wed, 21 Aug 2019 15:34:27 +0000 (+0300) Subject: RFC 8398: EAI comparison X-Git-Tag: openssl-3.0.0-alpha7~480 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=90c9319d47e9f8bdeea2a60362528e2061109544;p=thirdparty%2Fopenssl.git RFC 8398: EAI comparison Reviewed-by: Richard Levitte (Merged from https://github.com/openssl/openssl/pull/9654) --- diff --git a/crypto/x509/v3_utl.c b/crypto/x509/v3_utl.c index 9083ed86869..e31be45e03c 100644 --- a/crypto/x509/v3_utl.c +++ b/crypto/x509/v3_utl.c @@ -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;