if (ctx->pkey != NULL) {
provkey = evp_keymgmt_export_to_provider(ctx->pkey, ctx->keymgmt, 0);
- if (provkey == NULL) {
- EVPerr(0, EVP_R_INITIALIZATION_ERROR);
- goto err;
- }
+ /* If export failed, legacy may be able to pick it up */
+ if (provkey == NULL)
+ goto legacy;
}
ctx->op.kex.exchprovctx = exchange->newctx(ossl_provider_ctx(exchange->prov));
if (ctx->op.kex.exchprovctx == NULL) {
return 0;
legacy:
- if (ctx == NULL || ctx->pmeth == NULL || ctx->pmeth->derive == NULL) {
+ if (ctx->pmeth == NULL || ctx->pmeth->derive == NULL) {
EVPerr(0, EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE);
return -2;
}
}
provkey = evp_keymgmt_export_to_provider(peer, ctx->keymgmt, 0);
- if (provkey == NULL) {
- EVPerr(EVP_F_EVP_PKEY_DERIVE_SET_PEER, ERR_R_INTERNAL_ERROR);
- return 0;
- }
+ /* If export failed, legacy may be able to pick it up */
+ if (provkey == NULL)
+ goto legacy;
return ctx->op.kex.exchange->set_peer(ctx->op.kex.exchprovctx, provkey);
legacy:
locpctx->op.sig.signature = signature;
+ provkey =
+ evp_keymgmt_export_to_provider(locpctx->pkey, locpctx->keymgmt, 0);
+ /* If export failed, legacy may be able to pick it up */
+ if (provkey == NULL)
+ goto legacy;
+
locpctx->operation = ver ? EVP_PKEY_OP_VERIFYCTX
: EVP_PKEY_OP_SIGNCTX;
ERR_raise(ERR_LIB_EVP, EVP_R_INITIALIZATION_ERROR);
goto err;
}
- provkey =
- evp_keymgmt_export_to_provider(locpctx->pkey, locpctx->keymgmt, 0);
- if (provkey == NULL) {
- ERR_raise(ERR_LIB_EVP, EVP_R_INITIALIZATION_ERROR);
- goto err;
- }
-
if (type != NULL) {
ctx->reqdigest = type;
} else {
return 0;
legacy:
+ if (ctx->pctx->pmeth == NULL) {
+ EVPerr(0, EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE);
+ return -2;
+ }
+
if (!(ctx->pctx->pmeth->flags & EVP_PKEY_FLAG_SIGCTX_CUSTOM)) {
if (type == NULL) {
if (ctx->pkey != NULL) {
provkey =
evp_keymgmt_export_to_provider(ctx->pkey, ctx->keymgmt, 0);
- if (provkey == NULL) {
- EVPerr(0, EVP_R_INITIALIZATION_ERROR);
- goto err;
- }
+ /* If export failed, legacy may be able to pick it up */
+ if (provkey == NULL)
+ goto legacy;
}
ctx->op.sig.sigprovctx = signature->newctx(ossl_provider_ctx(signature->prov));
if (ctx->op.sig.sigprovctx == NULL) {
if (ctx->pkey != NULL) {
provkey = evp_keymgmt_export_to_provider(ctx->pkey, ctx->keymgmt, 0);
- if (provkey == NULL) {
- EVPerr(0, EVP_R_INITIALIZATION_ERROR);
- goto err;
- }
+ /* If export failed, legacy may be able to pick it up */
+ if (provkey == NULL)
+ goto legacy;
}
ctx->op.ciph.ciphprovctx = cipher->newctx(ossl_provider_ctx(cipher->prov));
if (ctx->op.ciph.ciphprovctx == NULL) {