summaryrefslogtreecommitdiff
path: root/providers/implementations/storemgmt
diff options
context:
space:
mode:
authorTomas Mraz <tomas@openssl.org>2021-06-08 18:25:09 +0200
committerTomas Mraz <tomas@openssl.org>2021-06-10 11:56:28 +0200
commit20e80ad1bc7e432f85e696d7272cbac3c69b5633 (patch)
tree3f4793b49cd2f1d6aea932fa889bbad11e24b35b /providers/implementations/storemgmt
parent726f92e016bac53175ed5d5321bce1ddf6b207d6 (diff)
downloadopenssl-new-20e80ad1bc7e432f85e696d7272cbac3c69b5633.tar.gz
store: Avoid spurious error from decoding at EOF
Fixes #15596 Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15661)
Diffstat (limited to 'providers/implementations/storemgmt')
-rw-r--r--providers/implementations/storemgmt/file_store.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/providers/implementations/storemgmt/file_store.c b/providers/implementations/storemgmt/file_store.c
index 04021f49c2..d9c465581e 100644
--- a/providers/implementations/storemgmt/file_store.c
+++ b/providers/implementations/storemgmt/file_store.c
@@ -518,6 +518,7 @@ static int file_load_file(struct file_ctx_st *ctx,
OSSL_PASSPHRASE_CALLBACK *pw_cb, void *pw_cbarg)
{
struct file_load_data_st data;
+ int ret, err;
/* Setup the decoders (one time shot per session */
@@ -533,7 +534,16 @@ static int file_load_file(struct file_ctx_st *ctx,
/* Launch */
- return OSSL_DECODER_from_bio(ctx->_.file.decoderctx, ctx->_.file.file);
+ ERR_set_mark();
+ ret = OSSL_DECODER_from_bio(ctx->_.file.decoderctx, ctx->_.file.file);
+ if (BIO_eof(ctx->_.file.file)
+ && ((err = ERR_peek_last_error()) != 0)
+ && ERR_GET_LIB(err) == ERR_LIB_OSSL_DECODER
+ && ERR_GET_REASON(err) == ERR_R_UNSUPPORTED)
+ ERR_pop_to_mark();
+ else
+ ERR_clear_last_mark();
+ return ret;
}
/*-