OSSL_STORE: Fix error flag clearing and setting (provider path only)
authorRichard Levitte <levitte@openssl.org>
Wed, 6 Sep 2023 05:13:26 +0000 (07:13 +0200)
committerRichard Levitte <levitte@openssl.org>
Fri, 8 Sep 2023 06:36:03 +0000 (08:36 +0200)
commit137e3a9ac07706a8ec65f2afd31236d9180ad4f0
treebc378ff1c9bfeae65e576882e64e2909d8bb7ca8
parent41136a998e833a2992b2026dc8b2e83ca7ceb0bd
OSSL_STORE: Fix error flag clearing and setting (provider path only)

When the provider's load function returned with an error, the libcrypto
error flag was only set if EOF hadn't been reached.  This is troublesome,
as an error can very well occur during the last load before EOF is reached!

Also, the error flag was never reset, even though documentation specifies
that it should indicate an error in the last load (i.e. not the one before
that).

Fixes #21968

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21976)

(cherry picked from commit 17dd9a2c6262c00800301fddd9441a9c590a630e)
crypto/store/store_lib.c