aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakub Zelenka <[email protected]>2026-07-22 00:11:24 +0200
committerNorbert Pocs <[email protected]>2026-07-27 11:05:54 +0200
commit22f58fd9cce68d32deb8a08ba54fcf2d2eaf0135 (patch)
tree4e481f494e5a7c1b39f1dcc67a264c3458873678
parentapps: fail skeyutl -genkey on bad -skeyopt (diff)
downloadopenssl-22f58fd9cce68d32deb8a08ba54fcf2d2eaf0135.tar.gz
openssl-22f58fd9cce68d32deb8a08ba54fcf2d2eaf0135.zip
test: support key options in the fake cipher provider
The fake cipher key management accepted a key name and raw key bytes on generation and import, but did not advertise them as settable parameters, so applications converting opt:value strings with OSSL_PARAM_allocate_from_text() had nothing to look them up in. Add the settable parameter table for both generation and import, and report the key name as the key id, so that setting it has an observable effect. Assisted-by: Claude:claude-opus-4-8 Reviewed-by: Paul Dale <[email protected]> Reviewed-by: Dmitry Belyavskiy <[email protected]> Reviewed-by: Daniel Kubec <[email protected]> MergeDate: Mon Jul 27 09:06:05 2026 (Merged from https://github.com/openssl/openssl/pull/32036)
-rw-r--r--test/fake_cipherprov.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/fake_cipherprov.c b/test/fake_cipherprov.c
index ad28a6b94b7..8f3a02e95bd 100644
--- a/test/fake_cipherprov.c
+++ b/test/fake_cipherprov.c
@@ -96,6 +96,27 @@ static void *fake_skeymgmt_generate(void *provctx, const OSSL_PARAM *params)
return ctx;
}
+static const char *fake_skeymgmt_get_key_id(void *keydata)
+{
+ PROV_CIPHER_FAKE_CTX *ctx = (PROV_CIPHER_FAKE_CTX *)keydata;
+
+ if (ctx == NULL || ctx->key_name[0] == '\0')
+ return NULL;
+
+ return ctx->key_name;
+}
+
+static const OSSL_PARAM fake_skeymgmt_known_settable_params[] = {
+ OSSL_PARAM_utf8_string(FAKE_CIPHER_PARAM_KEY_NAME, NULL, 0),
+ OSSL_PARAM_octet_string(OSSL_SKEY_PARAM_RAW_BYTES, NULL, 0),
+ OSSL_PARAM_END
+};
+
+static const OSSL_PARAM *fake_skeymgmt_settable_params(ossl_unused void *provctx)
+{
+ return fake_skeymgmt_known_settable_params;
+}
+
static int fake_skeymgmt_export(void *keydata, int selection,
OSSL_CALLBACK *param_callback, void *cbarg)
{
@@ -126,6 +147,11 @@ static const OSSL_DISPATCH fake_skeymgmt_funcs[] = {
{ OSSL_FUNC_SKEYMGMT_GENERATE, (void (*)(void))fake_skeymgmt_generate },
{ OSSL_FUNC_SKEYMGMT_IMPORT, (void (*)(void))fake_skeymgmt_import },
{ OSSL_FUNC_SKEYMGMT_EXPORT, (void (*)(void))fake_skeymgmt_export },
+ { OSSL_FUNC_SKEYMGMT_GET_KEY_ID, (void (*)(void))fake_skeymgmt_get_key_id },
+ { OSSL_FUNC_SKEYMGMT_IMP_SETTABLE_PARAMS,
+ (void (*)(void))fake_skeymgmt_settable_params },
+ { OSSL_FUNC_SKEYMGMT_GEN_SETTABLE_PARAMS,
+ (void (*)(void))fake_skeymgmt_settable_params },
OSSL_DISPATCH_END
};