On Tue, Jun 20, 2023 at 07:50:19PM +0200, Theo Buehler wrote:
> X509_get_ext_d2i() is one of those very special OpenSSL interfaces...
> 
> It can return NULL for various reasons. If it returns NULL and crit is
> not -1, something bad happened. If crit is -2, multiple extensions with
> the same OID as the one corresponding to the nid were found (this is not
> allowed per RFC 5280, 4.2). It returns NULL if it failed to deserialize
> the extension, be it due to bad DER or an allocation failure. In these
> cases crit will be 1 or 0, depending on whether the extension was marked
> critical.
> 
> So instead of accepting an object in the situation that crit != -1, we
> should warn and throw an error. We can't errx() since we can't really
> tell allocation failure from failure due to a malformed extension.
> 
> I also added a check for NULL and criticality of basic constraints,
> which were missing (per RFC 5280 criticality is optional, so libcrypto
> doesn't check that, but RFC 6487 is clear here).
> 
> The warnings in x509*inherits() are minimal. The callers of
> x509_inherits() warn. For x509_any_inherits() this is not so. The
> annoying bit is that it is used in auth_insert(). I know how I want
> to deal with that, but that is largely independent of this diff.

OK job@

Reply via email to