]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Update SAE test vector to IEEE Std 802.11-2020
authorJouni Malinen <jouni@codeaurora.org>
Fri, 9 Apr 2021 18:49:25 +0000 (21:49 +0300)
committerJouni Malinen <j@w1.fi>
Fri, 9 Apr 2021 18:51:46 +0000 (21:51 +0300)
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
src/common/common_module_tests.c

index 50ce1923c1201f6595ca0b984100f12c0aaf6ff3..d7b2c05ac73fda1038477b5b7f35dc738ae5114d 100644 (file)
@@ -256,87 +256,69 @@ static int sae_tests(void)
 #ifdef CONFIG_SAE
        struct sae_data sae;
        int ret = -1;
-       /* IEEE P802.11-REVmd/D2.1, Annex J.10 */
-       const u8 addr1[ETH_ALEN] = { 0x82, 0x7b, 0x91, 0x9d, 0xd4, 0xb9 };
-       const u8 addr2[ETH_ALEN] = { 0x1e, 0xec, 0x49, 0xea, 0x64, 0x88 };
+       /* IEEE Std 802.11-2020, Annex J.10 */
+       const u8 addr1[ETH_ALEN] = { 0x4d, 0x3f, 0x2f, 0xff, 0xe3, 0x87 };
+       const u8 addr2[ETH_ALEN] = { 0xa5, 0xd8, 0xaa, 0x95, 0x8e, 0x3c };
        const char *ssid = "byteme";
        const char *pw = "mekmitasdigoat";
        const char *pwid = "psk4internet";
        const u8 local_rand[] = {
-               0xa9, 0x06, 0xf6, 0x1e, 0x4d, 0x3a, 0x5d, 0x4e,
-               0xb2, 0x96, 0x5f, 0xf3, 0x4c, 0xf9, 0x17, 0xdd,
-               0x04, 0x44, 0x45, 0xc8, 0x78, 0xc1, 0x7c, 0xa5,
-               0xd5, 0xb9, 0x37, 0x86, 0xda, 0x9f, 0x83, 0xcf
+               0x99, 0x24, 0x65, 0xfd, 0x3d, 0xaa, 0x3c, 0x60,
+               0xaa, 0x65, 0x65, 0xb7, 0xf6, 0x2a, 0x2a, 0x7f,
+               0x2e, 0x12, 0xdd, 0x12, 0xf1, 0x98, 0xfa, 0xf4,
+               0xfb, 0xed, 0x89, 0xd7, 0xff, 0x1a, 0xce, 0x94
        };
        const u8 local_mask[] = {
-               0x42, 0x34, 0xb4, 0xfb, 0x17, 0xaa, 0x43, 0x5c,
-               0x52, 0xfb, 0xfd, 0xeb, 0xe6, 0x40, 0x39, 0xb4,
-               0x34, 0x78, 0x20, 0x0e, 0x54, 0xff, 0x7b, 0x6e,
-               0x07, 0xb6, 0x9c, 0xad, 0x74, 0x15, 0x3c, 0x15
+               0x95, 0x07, 0xa9, 0x0f, 0x77, 0x7a, 0x04, 0x4d,
+               0x6a, 0x08, 0x30, 0xb9, 0x1e, 0xa3, 0xd5, 0xdd,
+               0x70, 0xbe, 0xce, 0x44, 0xe1, 0xac, 0xff, 0xb8,
+               0x69, 0x83, 0xb5, 0xe1, 0xbf, 0x9f, 0xb3, 0x22
        };
        const u8 local_commit[] = {
-               0x13, 0x00, 0xeb, 0x3b, 0xab, 0x19, 0x64, 0xe4,
-               0xa0, 0xab, 0x05, 0x92, 0x5d, 0xdf, 0x33, 0x39,
-               0x51, 0x91, 0x38, 0xbc, 0x65, 0xd6, 0xcd, 0xc0,
-               0xf8, 0x13, 0xdd, 0x6f, 0xd4, 0x34, 0x4e, 0xb4,
-               0xbf, 0xe4, 0x4b, 0x5c, 0x21, 0x59, 0x76, 0x58,
-               0xf4, 0xe3, 0xed, 0xdf, 0xb4, 0xb9, 0x9f, 0x25,
-               0xb4, 0xd6, 0x54, 0x0f, 0x32, 0xff, 0x1f, 0xd5,
-               0xc5, 0x30, 0xc6, 0x0a, 0x79, 0x44, 0x48, 0x61,
-               0x0b, 0xc6, 0xde, 0x3d, 0x92, 0xbd, 0xbb, 0xd4,
-               0x7d, 0x93, 0x59, 0x80, 0xca, 0x6c, 0xf8, 0x98,
-               0x8a, 0xb6, 0x63, 0x0b, 0xe6, 0x76, 0x4c, 0x88,
-               0x5c, 0xeb, 0x97, 0x93, 0x97, 0x0f, 0x69, 0x52,
-               0x17, 0xee, 0xff, 0x0d, 0x21, 0x70, 0x73, 0x6b,
-               0x34, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x65,
-               0x74
+               0x13, 0x00, 0x2e, 0x2c, 0x0f, 0x0d, 0xb5, 0x24,
+               0x40, 0xad, 0x14, 0x6d, 0x96, 0x71, 0x14, 0xce,
+               0x00, 0x5c, 0xe1, 0xea, 0xb0, 0xaa, 0x2c, 0x2e,
+               0x5c, 0x28, 0x71, 0xb7, 0x74, 0xf6, 0xc2, 0x57,
+               0x5c, 0x65, 0xd5, 0xad, 0x9e, 0x00, 0x82, 0x97,
+               0x07, 0xaa, 0x36, 0xba, 0x8b, 0x85, 0x97, 0x38,
+               0xfc, 0x96, 0x1d, 0x08, 0x24, 0x35, 0x05, 0xf4,
+               0x7c, 0x03, 0x53, 0x76, 0xd7, 0xac, 0x4b, 0xc8,
+               0xd7, 0xb9, 0x50, 0x83, 0xbf, 0x43, 0x82, 0x7d,
+               0x0f, 0xc3, 0x1e, 0xd7, 0x78, 0xdd, 0x36, 0x71,
+               0xfd, 0x21, 0xa4, 0x6d, 0x10, 0x91, 0xd6, 0x4b,
+               0x6f, 0x9a, 0x1e, 0x12, 0x72, 0x62, 0x13, 0x25,
+               0xdb, 0xe1
        };
        const u8 peer_commit[] = {
-               0x13, 0x00, 0x55, 0x64, 0xf0, 0x45, 0xb2, 0xea,
-               0x1e, 0x56, 0x6c, 0xf1, 0xdd, 0x74, 0x1f, 0x70,
-               0xd9, 0xbe, 0x35, 0xd2, 0xdf, 0x5b, 0x9a, 0x55,
-               0x02, 0x94, 0x6e, 0xe0, 0x3c, 0xf8, 0xda, 0xe2,
-               0x7e, 0x1e, 0x05, 0xb8, 0x43, 0x0e, 0xb7, 0xa9,
-               0x9e, 0x24, 0x87, 0x7c, 0xe6, 0x9b, 0xaf, 0x3d,
-               0xc5, 0x80, 0xe3, 0x09, 0x63, 0x3d, 0x6b, 0x38,
-               0x5f, 0x83, 0xee, 0x1c, 0x3e, 0xc3, 0x59, 0x1f,
-               0x1a, 0x53, 0x93, 0xc0, 0x6e, 0x80, 0x5d, 0xdc,
-               0xeb, 0x2f, 0xde, 0x50, 0x93, 0x0d, 0xd7, 0xcf,
-               0xeb, 0xb9, 0x87, 0xc6, 0xff, 0x96, 0x66, 0xaf,
-               0x16, 0x4e, 0xb5, 0x18, 0x4d, 0x8e, 0x66, 0x62,
-               0xed, 0x6a, 0xff, 0x0d, 0x21, 0x70, 0x73, 0x6b,
-               0x34, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x65,
-               0x74
+               0x13, 0x00, 0x59, 0x1b, 0x96, 0xf3, 0x39, 0x7f,
+               0xb9, 0x45, 0x10, 0x08, 0x48, 0xe7, 0xb5, 0x50,
+               0x54, 0x3b, 0x67, 0x20, 0xd8, 0x83, 0x37, 0xee,
+               0x93, 0xfc, 0x49, 0xfd, 0x6d, 0xf7, 0xe0, 0x8b,
+               0x52, 0x23, 0xe7, 0x1b, 0x9b, 0xb0, 0x48, 0xd3,
+               0x87, 0x3f, 0x20, 0x55, 0x69, 0x53, 0xa9, 0x6c,
+               0x91, 0x53, 0x6f, 0xd8, 0xee, 0x6c, 0xa9, 0xb4,
+               0xa6, 0x8a, 0x14, 0x8b, 0x05, 0x6a, 0x90, 0x9b,
+               0xe0, 0x3e, 0x83, 0xae, 0x20, 0x8f, 0x60, 0xf8,
+               0xef, 0x55, 0x37, 0x85, 0x80, 0x74, 0xdb, 0x06,
+               0x68, 0x70, 0x32, 0x39, 0x98, 0x62, 0x99, 0x9b,
+               0x51, 0x1e, 0x0a, 0x15, 0x52, 0xa5, 0xfe, 0xa3,
+               0x17, 0xc2
        };
        const u8 kck[] = {
-               0x59, 0x9d, 0x6f, 0x1e, 0x27, 0x54, 0x8b, 0xe8,
-               0x49, 0x9d, 0xce, 0xed, 0x2f, 0xec, 0xcf, 0x94,
-               0x81, 0x8c, 0xe1, 0xc7, 0x9f, 0x1b, 0x4e, 0xb3,
-               0xd6, 0xa5, 0x32, 0x28, 0xa0, 0x9b, 0xf3, 0xed
+               0x1e, 0x73, 0x3f, 0x6d, 0x9b, 0xd5, 0x32, 0x56,
+               0x28, 0x73, 0x04, 0x33, 0x88, 0x31, 0xb0, 0x9a,
+               0x39, 0x40, 0x6d, 0x12, 0x10, 0x17, 0x07, 0x3a,
+               0x5c, 0x30, 0xdb, 0x36, 0xf3, 0x6c, 0xb8, 0x1a
        };
        const u8 pmk[] = {
-               0x7a, 0xea, 0xd8, 0x6f, 0xba, 0x4c, 0x32, 0x21,
-               0xfc, 0x43, 0x7f, 0x5f, 0x14, 0xd7, 0x0d, 0x85,
-               0x4e, 0xa5, 0xd5, 0xaa, 0xc1, 0x69, 0x01, 0x16,
-               0x79, 0x30, 0x81, 0xed, 0xa4, 0xd5, 0x57, 0xc5
+               0x4e, 0x4d, 0xfa, 0xb1, 0xa2, 0xdd, 0x8a, 0xc1,
+               0xa9, 0x17, 0x90, 0xf9, 0x53, 0xfa, 0xaa, 0x45,
+               0x2a, 0xe5, 0xc6, 0x87, 0x3a, 0xb7, 0x5b, 0x63,
+               0x60, 0x5b, 0xa6, 0x63, 0xf8, 0xa7, 0xfe, 0x59
        };
        const u8 pmkid[] = {
-               0x40, 0xa0, 0x9b, 0x60, 0x17, 0xce, 0xbf, 0x00,
-               0x72, 0x84, 0x3b, 0x53, 0x52, 0xaa, 0x2b, 0x4f
-       };
-       const u8 local_confirm[] = {
-               0x01, 0x00, 0x12, 0xd9, 0xd5, 0xc7, 0x8c, 0x50,
-               0x05, 0x26, 0xd3, 0x6c, 0x41, 0xdb, 0xc5, 0x6a,
-               0xed, 0xf2, 0x91, 0x4c, 0xed, 0xdd, 0xd7, 0xca,
-               0xd4, 0xa5, 0x8c, 0x48, 0xf8, 0x3d, 0xbd, 0xe9,
-               0xfc, 0x77
-       };
-       const u8 peer_confirm[] = {
-               0x01, 0x00, 0x02, 0x87, 0x1c, 0xf9, 0x06, 0x89,
-               0x8b, 0x80, 0x60, 0xec, 0x18, 0x41, 0x43, 0xbe,
-               0x77, 0xb8, 0xc0, 0x8a, 0x80, 0x19, 0xb1, 0x3e,
-               0xb6, 0xd0, 0xae, 0xf0, 0xd8, 0x38, 0x3d, 0xfa,
-               0xc2, 0xfd
+               0x87, 0x47, 0xa6, 0x00, 0xee, 0xa3, 0xf9, 0xf2,
+               0x24, 0x75, 0xdf, 0x58, 0xca, 0x1e, 0x54, 0x98
        };
        struct wpabuf *buf = NULL;
        struct crypto_bignum *mask = NULL;
@@ -412,7 +394,7 @@ static int sae_tests(void)
        if (!buf ||
            sae_set_group(&sae, 19) < 0 ||
            sae_prepare_commit(addr1, addr2, (const u8 *) pw, os_strlen(pw),
-                              pwid, &sae) < 0)
+                              NULL, &sae) < 0)
                goto fail;
 
        /* Override local values based on SAE test vector */
@@ -434,7 +416,7 @@ static int sae_tests(void)
                goto fail;
 
        /* Check that output matches the test vector */
-       if (sae_write_commit(&sae, buf, NULL, pwid) < 0)
+       if (sae_write_commit(&sae, buf, NULL, NULL) < 0)
                goto fail;
        wpa_hexdump_buf(MSG_DEBUG, "SAE: Commit message", buf);
 
@@ -465,21 +447,6 @@ static int sae_tests(void)
                goto fail;
        }
 
-       buf->used = 0;
-       sae.send_confirm = 1;
-       sae_write_confirm(&sae, buf);
-       wpa_hexdump_buf(MSG_DEBUG, "SAE: Confirm message", buf);
-
-       if (wpabuf_len(buf) != sizeof(local_confirm) ||
-           os_memcmp(wpabuf_head(buf), local_confirm,
-                     sizeof(local_confirm)) != 0) {
-               wpa_printf(MSG_ERROR, "SAE: Mismatch in local confirm");
-               goto fail;
-       }
-
-       if (sae_check_confirm(&sae, peer_confirm, sizeof(peer_confirm)) < 0)
-               goto fail;
-
        pt_info = sae_derive_pt(pt_groups,
                                (const u8 *) ssid, os_strlen(ssid),
                                (const u8 *) pw, os_strlen(pw), pwid);