aboutsummaryrefslogtreecommitdiff
path: root/crypto/encode_decode
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/encode_decode')
-rw-r--r--crypto/encode_decode/decoder_lib.c7
-rw-r--r--crypto/encode_decode/decoder_pkey.c8
2 files changed, 10 insertions, 5 deletions
diff --git a/crypto/encode_decode/decoder_lib.c b/crypto/encode_decode/decoder_lib.c
index e24d2c6cd588..2e4b7ed60b9c 100644
--- a/crypto/encode_decode/decoder_lib.c
+++ b/crypto/encode_decode/decoder_lib.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2020-2023 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@@ -743,10 +743,11 @@ static int decoder_process(const OSSL_PARAM params[], void *arg)
(void *)new_data.ctx, LEVEL, rv);
} OSSL_TRACE_END(DECODER);
- data->flag_construct_called = 1;
ok = (rv > 0);
- if (ok)
+ if (ok) {
+ data->flag_construct_called = 1;
goto end;
+ }
}
/* The constructor didn't return success */
diff --git a/crypto/encode_decode/decoder_pkey.c b/crypto/encode_decode/decoder_pkey.c
index ed10bb1cee03..ad5e2805319b 100644
--- a/crypto/encode_decode/decoder_pkey.c
+++ b/crypto/encode_decode/decoder_pkey.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2020-2023 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@@ -150,7 +150,11 @@ static int decoder_construct_pkey(OSSL_DECODER_INSTANCE *decoder_inst,
import_data.keymgmt = keymgmt;
import_data.keydata = NULL;
- import_data.selection = data->selection;
+ if (data->selection == 0)
+ /* import/export functions do not tolerate 0 selection */
+ import_data.selection = OSSL_KEYMGMT_SELECT_ALL;
+ else
+ import_data.selection = data->selection;
/*
* No need to check for errors here, the value of