]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
EAP-MSCHAPv2: Propagate GetAsymetricStartKey() failures up from getKey()
authorJouni Malinen <jouni@codeaurora.org>
Tue, 16 Apr 2019 18:21:35 +0000 (21:21 +0300)
committerJouni Malinen <j@w1.fi>
Tue, 16 Apr 2019 18:21:35 +0000 (21:21 +0300)
Report failure from getKey() if MSK cannot be derived due to unexpected
sha1_vector() local failure.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
src/eap_peer/eap_mschapv2.c
src/eap_server/eap_server_mschapv2.c

index 877495cf3ac72e81fd66baa7d96bda4919a7b2b4..249baec88ebb25e526f399b234f60269ec675765 100644 (file)
@@ -856,9 +856,13 @@ static u8 * eap_mschapv2_getKey(struct eap_sm *sm, void *priv, size_t *len)
 
        /* MSK = server MS-MPPE-Recv-Key | MS-MPPE-Send-Key, i.e.,
         *      peer MS-MPPE-Send-Key | MS-MPPE-Recv-Key */
-       get_asymetric_start_key(data->master_key, key, MSCHAPV2_KEY_LEN, 1, 0);
-       get_asymetric_start_key(data->master_key, key + MSCHAPV2_KEY_LEN,
-                               MSCHAPV2_KEY_LEN, 0, 0);
+       if (get_asymetric_start_key(data->master_key, key, MSCHAPV2_KEY_LEN, 1,
+                                   0) < 0 ||
+           get_asymetric_start_key(data->master_key, key + MSCHAPV2_KEY_LEN,
+                                   MSCHAPV2_KEY_LEN, 0, 0) < 0) {
+               os_free(key);
+               return NULL;
+       }
 
        wpa_hexdump_key(MSG_DEBUG, "EAP-MSCHAPV2: Derived key",
                        key, key_len);
index 6c47bb636aab9ca010c87495a8ed84b3d04fdd3a..e9e03b0afb452ea2cc39a7cdb60eca4623e16e00 100644 (file)
@@ -551,9 +551,13 @@ static u8 * eap_mschapv2_getKey(struct eap_sm *sm, void *priv, size_t *len)
        if (key == NULL)
                return NULL;
        /* MSK = server MS-MPPE-Recv-Key | MS-MPPE-Send-Key */
-       get_asymetric_start_key(data->master_key, key, MSCHAPV2_KEY_LEN, 0, 1);
-       get_asymetric_start_key(data->master_key, key + MSCHAPV2_KEY_LEN,
-                               MSCHAPV2_KEY_LEN, 1, 1);
+       if (get_asymetric_start_key(data->master_key, key, MSCHAPV2_KEY_LEN, 0,
+                                   1) < 0 ||
+           get_asymetric_start_key(data->master_key, key + MSCHAPV2_KEY_LEN,
+                                   MSCHAPV2_KEY_LEN, 1, 1) < 0) {
+               os_free(key);
+               return NULL;
+       }
        wpa_hexdump_key(MSG_DEBUG, "EAP-MSCHAPV2: Derived key", key, *len);
 
        return key;