mirror of
https://github.com/openssl/openssl.git
synced 2025-02-23 14:42:15 +08:00
Return -1 properly from do_X509_REQ_verify and do_X509_verify
Reviewed-by: Kurt Roeckx <kurt@roeckx.be> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/17001)
This commit is contained in:
parent
6cb814de6f
commit
bc42cf51c8
@ -2322,23 +2322,35 @@ int do_X509_CRL_sign(X509_CRL *x, EVP_PKEY *pkey, const char *md,
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* do_X509_verify returns 1 if the signature is valid,
|
||||||
|
* 0 if the signature check fails, or -1 if error occurs.
|
||||||
|
*/
|
||||||
int do_X509_verify(X509 *x, EVP_PKEY *pkey, STACK_OF(OPENSSL_STRING) *vfyopts)
|
int do_X509_verify(X509 *x, EVP_PKEY *pkey, STACK_OF(OPENSSL_STRING) *vfyopts)
|
||||||
{
|
{
|
||||||
int rv = 0;
|
int rv = 0;
|
||||||
|
|
||||||
if (do_x509_init(x, vfyopts) > 0)
|
if (do_x509_init(x, vfyopts) > 0)
|
||||||
rv = (X509_verify(x, pkey) > 0);
|
rv = X509_verify(x, pkey);
|
||||||
|
else
|
||||||
|
rv = -1;
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* do_X509_REQ_verify returns 1 if the signature is valid,
|
||||||
|
* 0 if the signature check fails, or -1 if error occurs.
|
||||||
|
*/
|
||||||
int do_X509_REQ_verify(X509_REQ *x, EVP_PKEY *pkey,
|
int do_X509_REQ_verify(X509_REQ *x, EVP_PKEY *pkey,
|
||||||
STACK_OF(OPENSSL_STRING) *vfyopts)
|
STACK_OF(OPENSSL_STRING) *vfyopts)
|
||||||
{
|
{
|
||||||
int rv = 0;
|
int rv = 0;
|
||||||
|
|
||||||
if (do_x509_req_init(x, vfyopts) > 0)
|
if (do_x509_req_init(x, vfyopts) > 0)
|
||||||
rv = (X509_REQ_verify_ex(x, pkey,
|
rv = X509_REQ_verify_ex(x, pkey,
|
||||||
app_get0_libctx(), app_get0_propq()) > 0);
|
app_get0_libctx(), app_get0_propq());
|
||||||
|
else
|
||||||
|
rv = -1;
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user