]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: crypto_hash_finish() failure in eap_pwd_kdf()
authorJouni Malinen <j@w1.fi>
Sat, 13 Apr 2019 09:53:42 +0000 (12:53 +0300)
committerJouni Malinen <j@w1.fi>
Sat, 13 Apr 2019 09:53:42 +0000 (12:53 +0300)
Signed-off-by: Jouni Malinen <j@w1.fi>
src/crypto/crypto_internal.c
src/crypto/crypto_libtomcrypt.c
src/crypto/crypto_linux.c
src/crypto/crypto_openssl.c
src/crypto/crypto_wolfssl.c
tests/hwsim/test_eap_proto.py

index d391f48ab5b18f7161a4d0136f3e26d7d1b43855..aad40af16e06e3cc9e7c1b53b2bacbabf1bb5412 100644 (file)
@@ -310,6 +310,9 @@ int crypto_hash_finish(struct crypto_hash *ctx, u8 *mac, size_t *len)
 
        os_free(ctx);
 
+       if (TEST_FAIL())
+               return -1;
+
        return 0;
 }
 
index 980fa42274f6cb9e541a7540c68676c2d5d1aade..ed30efa021d76d4bde3df91c3355183580997024 100644 (file)
@@ -278,6 +278,9 @@ int crypto_hash_finish(struct crypto_hash *ctx, u8 *mac, size_t *len)
 
        os_free(ctx);
 
+       if (TEST_FAIL())
+               return -1;
+
        return ret;
 }
 
index 8099193bf0682b97ca1c4f0156f4300fdcc68640..17244561b372f7612faa7b63c6db29f06766762e 100644 (file)
@@ -386,6 +386,9 @@ int crypto_hash_finish(struct crypto_hash *ctx, u8 *mac, size_t *len)
        }
 
        crypto_hash_deinit(ctx);
+
+       if (TEST_FAIL())
+               return -1;
        return 0;
 }
 
index 0f52101ea727c7c262635b35d68dba3f3e5eb67e..9672f711cd3e58a73577a9f6599989d310fe8e2a 100644 (file)
@@ -1054,6 +1054,9 @@ int crypto_hash_finish(struct crypto_hash *ctx, u8 *mac, size_t *len)
        HMAC_CTX_free(ctx->ctx);
        bin_clear_free(ctx, sizeof(*ctx));
 
+       if (TEST_FAIL())
+               return -1;
+
        if (res == 1) {
                *len = mdlen;
                return 0;
index 10cdae6048670d0c316adb164b4278cb48db27b1..07ad1aa4a104defe45d932d5ece8538da66612db 100644 (file)
@@ -953,6 +953,8 @@ int crypto_hash_finish(struct crypto_hash *ctx, u8 *mac, size_t *len)
        ret = 0;
 done:
        bin_clear_free(ctx, sizeof(*ctx));
+       if (TEST_FAIL())
+               return -1;
        return ret;
 }
 
index 971ae8cbce0d4d33250b71554306deda1dc6ee7f..b6b42bcc235c5e4bb1057cdd19234509ca1a17e9 100644 (file)
@@ -6783,17 +6783,19 @@ def test_eap_proto_pwd_errors(dev, apdev):
     dev[0].request("REMOVE_NETWORK all")
     dev[0].wait_disconnected()
 
-    with fail_test(dev[0], 1,
-                   "hash_nt_password_hash;eap_pwd_perform_commit_exchange"):
-        dev[0].connect("eap-test", key_mgmt="WPA-EAP", scan_freq="2412",
-                       eap="PWD", identity="pwd-hash",
-                       password_hex="hash:e3718ece8ab74792cbbfffd316d2d19a",
-                       wait_connect=False)
-        ev = dev[0].wait_event(["CTRL-EVENT-EAP-FAILURE"], timeout=10)
-        if ev is None:
-            raise Exception("No EAP-Failure reported")
-        dev[0].request("REMOVE_NETWORK all")
-        dev[0].wait_disconnected()
+    funcs = ["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",
+                           eap="PWD", identity="pwd-hash",
+                           password_hex="hash:e3718ece8ab74792cbbfffd316d2d19a",
+                           wait_connect=False)
+            ev = dev[0].wait_event(["CTRL-EVENT-EAP-FAILURE"], timeout=10)
+            if ev is None:
+                raise Exception("No EAP-Failure reported")
+            dev[0].request("REMOVE_NETWORK all")
+            dev[0].wait_disconnected()
 
     params = {"ssid": "eap-test2", "wpa": "2", "wpa_key_mgmt": "WPA-EAP",
               "rsn_pairwise": "CCMP", "ieee8021x": "1",