Fix multiple wrong checks of EVP_PKEY_set1_encoded_public_key
Reviewed-by: Paul Dale <ppzgs1@gmail.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/25811)
This commit is contained in:
parent
1a93be1eab
commit
1273fae170
@ -65,7 +65,7 @@ static int dh_cms_set_peerkey(EVP_PKEY_CTX *pctx,
|
|||||||
pkpeer = EVP_PKEY_new();
|
pkpeer = EVP_PKEY_new();
|
||||||
if (pkpeer == NULL
|
if (pkpeer == NULL
|
||||||
|| !EVP_PKEY_copy_parameters(pkpeer, pk)
|
|| !EVP_PKEY_copy_parameters(pkpeer, pk)
|
||||||
|| !EVP_PKEY_set1_encoded_public_key(pkpeer, buf, plen))
|
|| EVP_PKEY_set1_encoded_public_key(pkpeer, buf, plen) <= 0)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
if (EVP_PKEY_derive_set_peer(pctx, pkpeer) > 0)
|
if (EVP_PKEY_derive_set_peer(pctx, pkpeer) > 0)
|
||||||
|
@ -111,7 +111,7 @@ static int ecdh_cms_set_peerkey(EVP_PKEY_CTX *pctx,
|
|||||||
if (p == NULL || plen == 0)
|
if (p == NULL || plen == 0)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
if (!EVP_PKEY_set1_encoded_public_key(pkpeer, p, plen))
|
if (EVP_PKEY_set1_encoded_public_key(pkpeer, p, plen) <= 0)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
if (EVP_PKEY_derive_set_peer(pctx, pkpeer) > 0)
|
if (EVP_PKEY_derive_set_peer(pctx, pkpeer) > 0)
|
||||||
|
@ -3086,7 +3086,7 @@ static int tls_process_cke_dhe(SSL_CONNECTION *s, PACKET *pkt)
|
|||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!EVP_PKEY_set1_encoded_public_key(ckey, data, i)) {
|
if (EVP_PKEY_set1_encoded_public_key(ckey, data, i) <= 0) {
|
||||||
SSLfatal(s, SSL_AD_INTERNAL_ERROR, ERR_R_INTERNAL_ERROR);
|
SSLfatal(s, SSL_AD_INTERNAL_ERROR, ERR_R_INTERNAL_ERROR);
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user