X509V3_EXT_print(): Return only 0 or 1 as the callers expect#29981
X509V3_EXT_print(): Return only 0 or 1 as the callers expect#29981t8m wants to merge 1 commit intoopenssl:masterfrom
Conversation
|
Either way the behavior should be documented to avoid future confusion. |
Sure, but that should be a separate PR IMO. I unfortunately do not have time to write that documentation currently. |
Fair, I've submitted a PR for that. I like this alternative and it is consistent with documentation from openbsd. |
There was a problem hiding this comment.
I see this PR as the best solution because:
Looking at the semantics and the code of X509V3_EXT_print() and unknown_ext_print() I see not much reason to differentiate various reasons for non-success outcome and believe that the actual oversight was in unknown_ext_print() to use return BIO_dump_indent(out, (const char *)ext, extlen, indent) rather than return BIO_dump_indent(out, (const char *)ext, extlen, indent) > 0.
Having a closer look, I just found that ASN1_parse_dump(), which is also used by unknown_ext_print(), can even return 2!
So good that here return ASN1_parse_dump(out, ext, extlen, indent, -1) is changed to return ASN1_parse_dump(out, ext, extlen, indent, -1) > 0.
Alternative to #29793