This allows to use SKEY even w/o a specific skey managment available,
however it bears the risk of allowing users to mispell the key type
and not see the error of their ways until they expect a specific
provider to pick this up and fail.
Signed-off-by: Simo Sorce <simo@redhat.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/26753)
skeymgmt = EVP_SKEYMGMT_fetch(libctx, skeymgmtname, propquery);
if (skeymgmt == NULL) {
- ERR_raise(ERR_LIB_EVP, ERR_R_FETCH_FAILED);
- goto err;
+ /*
+ * if the specific key_type is unknown, attempt to use the generic
+ * key management
+ */
+ skeymgmt = EVP_SKEYMGMT_fetch(libctx, OSSL_SKEY_TYPE_GENERIC, propquery);
+ if (skeymgmt == NULL) {
+ ERR_raise(ERR_LIB_EVP, ERR_R_FETCH_FAILED);
+ goto err;
+ }
}
skey->skeymgmt = skeymgmt;
goto end;
/* Create EVP_SKEY */
- skey = EVP_SKEY_import_raw_key(libctx, "GENERIC-SECRET", des_key,
- sizeof(des_key), NULL);
+ skey = EVP_SKEY_import_raw_key(libctx, "DES", des_key, sizeof(des_key),
+ NULL);
if (!TEST_ptr(skey))
goto end;