diff --git a/src/store.c b/src/store.c index 27d2e5f3..904f46ff 100644 --- a/src/store.c +++ b/src/store.c @@ -594,19 +594,20 @@ int p11prov_store_direct_fetch(void *provctx, const char *uri, OSSL_CALLBACK *object_cb, void *object_cbarg, OSSL_PASSPHRASE_CALLBACK *pw_cb, void *pw_cbarg) { + int ret = RET_OSSL_OK; struct p11prov_store_ctx *ctx = NULL; ctx = p11prov_store_open(provctx, uri); if (!ctx) { return RET_OSSL_ERR; } - int ret = RET_OSSL_OK; - while (ret == RET_OSSL_OK) { - ret = p11prov_store_load(ctx, object_cb, object_cbarg, pw_cb, pw_cbarg); - } + do { + ret &= + p11prov_store_load(ctx, object_cb, object_cbarg, pw_cb, pw_cbarg); + } while (!p11prov_store_eof(ctx)); p11prov_store_ctx_free(ctx); - return RET_OSSL_OK; + return ret; } const OSSL_DISPATCH p11prov_store_functions[] = {