tests: crypto_hash_finish() failure in eap_pwd_kdf()

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2019-04-13 12:53:42 +03:00
parent e8d8f4b680
commit 52b1cb5d73
6 changed files with 27 additions and 11 deletions

View file

@ -310,6 +310,9 @@ int crypto_hash_finish(struct crypto_hash *ctx, u8 *mac, size_t *len)
os_free(ctx); os_free(ctx);
if (TEST_FAIL())
return -1;
return 0; return 0;
} }

View file

@ -278,6 +278,9 @@ int crypto_hash_finish(struct crypto_hash *ctx, u8 *mac, size_t *len)
os_free(ctx); os_free(ctx);
if (TEST_FAIL())
return -1;
return ret; return ret;
} }

View file

@ -386,6 +386,9 @@ int crypto_hash_finish(struct crypto_hash *ctx, u8 *mac, size_t *len)
} }
crypto_hash_deinit(ctx); crypto_hash_deinit(ctx);
if (TEST_FAIL())
return -1;
return 0; return 0;
} }

View file

@ -1054,6 +1054,9 @@ int crypto_hash_finish(struct crypto_hash *ctx, u8 *mac, size_t *len)
HMAC_CTX_free(ctx->ctx); HMAC_CTX_free(ctx->ctx);
bin_clear_free(ctx, sizeof(*ctx)); bin_clear_free(ctx, sizeof(*ctx));
if (TEST_FAIL())
return -1;
if (res == 1) { if (res == 1) {
*len = mdlen; *len = mdlen;
return 0; return 0;

View file

@ -953,6 +953,8 @@ int crypto_hash_finish(struct crypto_hash *ctx, u8 *mac, size_t *len)
ret = 0; ret = 0;
done: done:
bin_clear_free(ctx, sizeof(*ctx)); bin_clear_free(ctx, sizeof(*ctx));
if (TEST_FAIL())
return -1;
return ret; return ret;
} }

View file

@ -6783,8 +6783,10 @@ def test_eap_proto_pwd_errors(dev, apdev):
dev[0].request("REMOVE_NETWORK all") dev[0].request("REMOVE_NETWORK all")
dev[0].wait_disconnected() dev[0].wait_disconnected()
with fail_test(dev[0], 1, funcs = ["hash_nt_password_hash;eap_pwd_perform_commit_exchange",
"hash_nt_password_hash;eap_pwd_perform_commit_exchange"): "crypto_hash_finish;eap_pwd_kdf"]
for func in funcs:
with fail_test(dev[0], 1, func):
dev[0].connect("eap-test", key_mgmt="WPA-EAP", scan_freq="2412", dev[0].connect("eap-test", key_mgmt="WPA-EAP", scan_freq="2412",
eap="PWD", identity="pwd-hash", eap="PWD", identity="pwd-hash",
password_hex="hash:e3718ece8ab74792cbbfffd316d2d19a", password_hex="hash:e3718ece8ab74792cbbfffd316d2d19a",