Skip to content

asn1_d2i_read_bio() has brittle design depending on the error queue #15219

@DDvO

Description

@DDvO

After (as part of #15147) making ASN1_{,item_}d2i_bio() conservative on the error queue
by replacing ERR_clear_error() by ERR_set_mark() and friends, I got very weird regressions on private key file loading etc.

It took me a hell lot of work to find out that this is due to a nasty design of asn1_d2i_read_bio() and its sub-functions: unless the error queue is emptied initially, they go wrong causing all sorts of test failures related to OSSL_STORE.

The design should be changed to avoid such brittle behavior.

If not possible in the near future,

  • this unexpected behavior should be clearly documented at the code line containing ERR_clear_error()
  • documentation of functions calling asn1_d2i_read_bio() should mention that unfortunately they clear the error queue.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions