mirror of
https://github.com/openssl/openssl.git
synced 2024-11-21 01:15:20 +08:00
dh: fix coverity 1473238: argument cannot be negative
Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/14620)
This commit is contained in:
parent
c12bf35026
commit
fd0a9ff7ef
@ -463,10 +463,11 @@ static int pkey_dh_derive(EVP_PKEY_CTX *ctx, unsigned char *key,
|
||||
if (*keylen != dctx->kdf_outlen)
|
||||
return 0;
|
||||
ret = 0;
|
||||
Zlen = DH_size(dh);
|
||||
Z = OPENSSL_malloc(Zlen);
|
||||
if (Z == NULL) {
|
||||
goto err;
|
||||
if ((Zlen = DH_size(dh)) <= 0)
|
||||
return 0;
|
||||
if ((Z = OPENSSL_malloc(Zlen)) == NULL) {
|
||||
ERR_raise(ERR_LIB_DH, ERR_R_MALLOC_FAILURE);
|
||||
return 0;
|
||||
}
|
||||
if (DH_compute_key_padded(Z, dhpubbn, dh) <= 0)
|
||||
goto err;
|
||||
|
Loading…
Reference in New Issue
Block a user