mirror of
https://github.com/nodejs/node.git
synced 2026-11-24 21:50:36 -05:00
crypto: simplify assertions in Safe*Print
Checking the X509V3_EXT_METHOD doesn't do anything. X509V3_EXT_get is already implemented by calling X509V3_EXT_get_nid on the extension's NID. We may as well just check the NID directly. PR-URL: https://github.com/nodejs/node/pull/49709 Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Richard Lau <rlau@redhat.com>
This commit is contained in:
1 parent
27ffa35540
commit
910533fcfd
1 file changed
+2
-4
@@ -815,8 +815,7 @@ static bool PrintGeneralName(const BIOPointer& out, const GENERAL_NAME* gen) {
|
||||
}
|
||||
|
||||
bool SafeX509SubjectAltNamePrint(const BIOPointer& out, X509_EXTENSION* ext) {
|
||||
const X509V3_EXT_METHOD* method = X509V3_EXT_get(ext);
|
||||
CHECK(method == X509V3_EXT_get_nid(NID_subject_alt_name));
|
||||
CHECK_EQ(OBJ_obj2nid(X509_EXTENSION_get_object(ext)), NID_subject_alt_name);
|
||||
|
||||
GENERAL_NAMES* names = static_cast<GENERAL_NAMES*>(X509V3_EXT_d2i(ext));
|
||||
if (names == nullptr)
|
||||
@@ -840,8 +839,7 @@ bool SafeX509SubjectAltNamePrint(const BIOPointer& out, X509_EXTENSION* ext) {
|
||||
}
|
||||
|
||||
bool SafeX509InfoAccessPrint(const BIOPointer& out, X509_EXTENSION* ext) {
|
||||
const X509V3_EXT_METHOD* method = X509V3_EXT_get(ext);
|
||||
CHECK(method == X509V3_EXT_get_nid(NID_info_access));
|
||||
CHECK_EQ(OBJ_obj2nid(X509_EXTENSION_get_object(ext)), NID_info_access);
|
||||
|
||||
AUTHORITY_INFO_ACCESS* descs =
|
||||
static_cast<AUTHORITY_INFO_ACCESS*>(X509V3_EXT_d2i(ext));
|
||||
|
||||
Reference in new issue
Block a user