| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -692,9 +692,8 @@ static inline void PrintUtf8AltName(const BIOPointer& out, | |||
| 692 | 692 | true, safe_prefix); | |
| 693 | 693 | } | |
| 694 | 694 | ||
| 695 | - // This function currently emulates the behavior of i2v_GENERAL_NAME in a safer | ||
| 696 | - // and less ambiguous way. | ||
| 697 | - // TODO(tniessen): gradually improve the format in the next major version(s) | ||
| 695 | + // This function emulates the behavior of i2v_GENERAL_NAME in a safer and less | ||
| 696 | + // ambiguous way. "othername:" entries use the GENERAL_NAME_print format. | ||
| 698 | 697 | static bool PrintGeneralName(const BIOPointer& out, const GENERAL_NAME* gen) { | |
| 699 | 698 | if (gen->type == GEN_DNS) { | |
| 700 | 699 | ASN1_IA5STRING* name = gen->d.dNSName; | |
@@ -767,33 +766,32 @@ static bool PrintGeneralName(const BIOPointer& out, const GENERAL_NAME* gen) { | |||
| 767 | 766 | OBJ_obj2txt(oline, sizeof(oline), gen->d.rid, true); | |
| 768 | 767 | BIO_printf(out.get(), "Registered ID:%s", oline); | |
| 769 | 768 | } else if (gen->type == GEN_OTHERNAME) { | |
| 770 | - // TODO(tniessen): the format that is used here is based on OpenSSL's | ||
| 771 | - // implementation of i2v_GENERAL_NAME (as of OpenSSL 3.0.1), mostly for | ||
| 772 | - // backward compatibility. It is somewhat awkward, especially when passed to | ||
| 773 | - // translatePeerCertificate, and should be changed in the future, probably | ||
| 774 | - // to the format used by GENERAL_NAME_print (in a major release). | ||
| 769 | + // The format that is used here is based on OpenSSL's implementation of | ||
| 770 | + // GENERAL_NAME_print (as of OpenSSL 3.0.1). Earlier versions of Node.js | ||
| 771 | + // instead produced the same format as i2v_GENERAL_NAME, which was somewhat | ||
| 772 | + // awkward, especially when passed to translatePeerCertificate. | ||
| 775 | 773 | bool unicode = true; | |
| 776 | 774 | const char* prefix = nullptr; | |
| 777 | - // OpenSSL 1.1.1 does not support othername in i2v_GENERAL_NAME and may not | ||
| 778 | - // define these NIDs. | ||
| 775 | + // OpenSSL 1.1.1 does not support othername in GENERAL_NAME_print and may | ||
| 776 | + // not define these NIDs. | ||
| 779 | 777 | #if OPENSSL_VERSION_MAJOR >= 3 | |
| 780 | 778 | int nid = OBJ_obj2nid(gen->d.otherName->type_id); | |
| 781 | 779 | switch (nid) { | |
| 782 | 780 | case NID_id_on_SmtpUTF8Mailbox: | |
| 783 | - prefix = " SmtpUTF8Mailbox:"; | ||
| 781 | + prefix = "SmtpUTF8Mailbox"; | ||
| 784 | 782 | break; | |
| 785 | 783 | case NID_XmppAddr: | |
| 786 | - prefix = " XmppAddr:"; | ||
| 784 | + prefix = "XmppAddr"; | ||
| 787 | 785 | break; | |
| 788 | 786 | case NID_SRVName: | |
| 789 | - prefix = " SRVName:"; | ||
| 787 | + prefix = "SRVName"; | ||
| 790 | 788 | unicode = false; | |
| 791 | 789 | break; | |
| 792 | 790 | case NID_ms_upn: | |
| 793 | - prefix = " UPN:"; | ||
| 791 | + prefix = "UPN"; | ||
| 794 | 792 | break; | |
| 795 | 793 | case NID_NAIRealm: | |
| 796 | - prefix = " NAIRealm:"; | ||
| 794 | + prefix = "NAIRealm"; | ||
| 797 | 795 | break; | |
| 798 | 796 | } | |
| 799 | 797 | #endif // OPENSSL_VERSION_MAJOR >= 3 | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -88,22 +88,22 @@ const { hasOpenSSL3 } = common; | |||
| 88 | 88 | // OpenSSL should not know it. | |
| 89 | 89 | 'Registered ID:1.3.9999.12.34', | |
| 90 | 90 | hasOpenSSL3 ? | |
| 91 | - 'othername: XmppAddr::abc123' : | ||
| 91 | + 'othername:XmppAddr:abc123' : | ||
| 92 | 92 | 'othername:<unsupported>', | |
| 93 | 93 | hasOpenSSL3 ? | |
| 94 | - 'othername:" XmppAddr::abc123\\u002c DNS:good.example.com"' : | ||
| 94 | + 'othername:"XmppAddr:abc123\\u002c DNS:good.example.com"' : | ||
| 95 | 95 | 'othername:<unsupported>', | |
| 96 | 96 | hasOpenSSL3 ? | |
| 97 | - 'othername:" XmppAddr::good.example.com\\u0000abc123"' : | ||
| 97 | + 'othername:"XmppAddr:good.example.com\\u0000abc123"' : | ||
| 98 | 98 | 'othername:<unsupported>', | |
| 99 | 99 | // This is unsupported because the OID is not recognized. | |
| 100 | 100 | 'othername:<unsupported>', | |
| 101 | - hasOpenSSL3 ? 'othername: SRVName::abc123' : 'othername:<unsupported>', | ||
| 101 | + hasOpenSSL3 ? 'othername:SRVName:abc123' : 'othername:<unsupported>', | ||
| 102 | 102 | // This is unsupported because it is an SRVName with a UTF8String value, | |
| 103 | 103 | // which is not allowed for SRVName. | |
| 104 | 104 | 'othername:<unsupported>', | |
| 105 | 105 | hasOpenSSL3 ? | |
| 106 | - 'othername:" SRVName::abc\\u0000def"' : | ||
| 106 | + 'othername:"SRVName:abc\\u0000def"' : | ||
| 107 | 107 | 'othername:<unsupported>', | |
| 108 | 108 | ]; | |
| 109 | 109 | ||
@@ -173,14 +173,14 @@ const { hasOpenSSL3 } = common; | |||
| 173 | 173 | }, | |
| 174 | 174 | }, | |
| 175 | 175 | hasOpenSSL3 ? { | |
| 176 | - text: 'OCSP - othername: XmppAddr::good.example.com\n' + | ||
| 176 | + text: 'OCSP - othername:XmppAddr:good.example.com\n' + | ||
| 177 | 177 | 'OCSP - othername:<unsupported>\n' + | |
| 178 | - 'OCSP - othername: SRVName::abc123', | ||
| 178 | + 'OCSP - othername:SRVName:abc123', | ||
| 179 | 179 | legacy: { | |
| 180 | 180 | 'OCSP - othername': [ | |
| 181 | - ' XmppAddr::good.example.com', | ||
| 181 | + 'XmppAddr:good.example.com', | ||
| 182 | 182 | '<unsupported>', | |
| 183 | - ' SRVName::abc123', | ||
| 183 | + 'SRVName:abc123', | ||
| 184 | 184 | ], | |
| 185 | 185 | }, | |
| 186 | 186 | } : { | |
@@ -196,10 +196,10 @@ const { hasOpenSSL3 } = common; | |||
| 196 | 196 | }, | |
| 197 | 197 | }, | |
| 198 | 198 | hasOpenSSL3 ? { | |
| 199 | - text: 'OCSP - othername:" XmppAddr::good.example.com\\u0000abc123"', | ||
| 199 | + text: 'OCSP - othername:"XmppAddr:good.example.com\\u0000abc123"', | ||
| 200 | 200 | legacy: { | |
| 201 | 201 | 'OCSP - othername': [ | |
| 202 | - ' XmppAddr::good.example.com\0abc123', | ||
| 202 | + 'XmppAddr:good.example.com\0abc123', | ||
| 203 | 203 | ], | |
| 204 | 204 | }, | |
| 205 | 205 | } : { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments