add NULL checks (encountered during tests/hwsim)

sae_derive_commit_element_ecc NULL pwe_ecc check
dpp_gen_keypair() NULL curve check

Signed-off-by: Glenn Strauss <gstrauss@gluelogic.com>
This commit is contained in:
Glenn Strauss 2022-08-12 05:34:47 -04:00 committed by sinavir
parent 41cdd916ba
commit 687ef821ce
No known key found for this signature in database
2 changed files with 13 additions and 0 deletions

View file

@ -269,6 +269,12 @@ int dpp_get_pubkey_hash(struct crypto_ec_key *key, u8 *hash)
struct crypto_ec_key * dpp_gen_keypair(const struct dpp_curve_params *curve)
{
if (curve == NULL) {
wpa_printf(MSG_DEBUG,
"DPP: %s curve must be initialized", __func__);
return NULL;
}
struct crypto_ec_key *key;
wpa_printf(MSG_DEBUG, "DPP: Generating a keypair");

View file

@ -1279,6 +1279,13 @@ void sae_deinit_pt(struct sae_pt *pt)
static int sae_derive_commit_element_ecc(struct sae_data *sae,
struct crypto_bignum *mask)
{
if (sae->tmp->pwe_ecc == NULL) {
wpa_printf(MSG_DEBUG,
"SAE: %s sae->tmp->pwe_ecc must be initialized",
__func__);
return -1;
}
/* COMMIT-ELEMENT = inverse(scalar-op(mask, PWE)) */
if (!sae->tmp->own_commit_element_ecc) {
sae->tmp->own_commit_element_ecc =