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:
parent
41cdd916ba
commit
687ef821ce
2 changed files with 13 additions and 0 deletions
|
@ -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)
|
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;
|
struct crypto_ec_key *key;
|
||||||
|
|
||||||
wpa_printf(MSG_DEBUG, "DPP: Generating a keypair");
|
wpa_printf(MSG_DEBUG, "DPP: Generating a keypair");
|
||||||
|
|
|
@ -1279,6 +1279,13 @@ void sae_deinit_pt(struct sae_pt *pt)
|
||||||
static int sae_derive_commit_element_ecc(struct sae_data *sae,
|
static int sae_derive_commit_element_ecc(struct sae_data *sae,
|
||||||
struct crypto_bignum *mask)
|
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)) */
|
/* COMMIT-ELEMENT = inverse(scalar-op(mask, PWE)) */
|
||||||
if (!sae->tmp->own_commit_element_ecc) {
|
if (!sae->tmp->own_commit_element_ecc) {
|
||||||
sae->tmp->own_commit_element_ecc =
|
sae->tmp->own_commit_element_ecc =
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue