mirror of https://github.com/openssl/openssl.git
crypto/evp/signature.c: add checks for consistent presence of 'update' and 'final' functions
Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/27367)
This commit is contained in:
parent
1146b74a8a
commit
8626a716b0
|
@ -421,6 +421,35 @@ static void *evp_signature_from_algorithm(int name_id,
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((signature->sign_message_update == NULL) !=
|
||||||
|
(signature->sign_message_final == NULL)) {
|
||||||
|
ERR_raise_data(ERR_LIB_EVP, EVP_R_INVALID_PROVIDER_FUNCTIONS,
|
||||||
|
"only one of %s message signing update and final available:%s",
|
||||||
|
signature->type_name, desc);
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
|
if ((signature->verify_message_update == NULL) !=
|
||||||
|
(signature->verify_message_final == NULL)) {
|
||||||
|
ERR_raise_data(ERR_LIB_EVP, EVP_R_INVALID_PROVIDER_FUNCTIONS,
|
||||||
|
"only one of %s message verification update and final available:%s",
|
||||||
|
signature->type_name, desc);
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
|
if ((signature->digest_sign_update == NULL) !=
|
||||||
|
(signature->digest_sign_final == NULL)) {
|
||||||
|
ERR_raise_data(ERR_LIB_EVP, EVP_R_INVALID_PROVIDER_FUNCTIONS,
|
||||||
|
"only one of %s digest signing update and final available:%s",
|
||||||
|
signature->type_name, desc);
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
|
if ((signature->digest_verify_update == NULL) !=
|
||||||
|
(signature->digest_verify_final == NULL)) {
|
||||||
|
ERR_raise_data(ERR_LIB_EVP, EVP_R_INVALID_PROVIDER_FUNCTIONS,
|
||||||
|
"only one of %s digest verification update and final available:%s",
|
||||||
|
signature->type_name, desc);
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
|
|
||||||
return signature;
|
return signature;
|
||||||
err:
|
err:
|
||||||
EVP_SIGNATURE_free(signature);
|
EVP_SIGNATURE_free(signature);
|
||||||
|
|
Loading…
Reference in New Issue