|
@@ -355,6 +355,23 @@ eap_pwd_perform_commit_exchange(struct eap_sm *sm, struct eap_pwd_data *data,
|
|
|
BIGNUM *mask = NULL, *x = NULL, *y = NULL, *cofactor = NULL;
|
|
|
u16 offset;
|
|
|
u8 *ptr, *scalar = NULL, *element = NULL;
|
|
|
+ size_t prime_len, order_len;
|
|
|
+
|
|
|
+ if (data->state != PWD_Commit_Req) {
|
|
|
+ ret->ignore = TRUE;
|
|
|
+ goto fin;
|
|
|
+ }
|
|
|
+
|
|
|
+ prime_len = BN_num_bytes(data->grp->prime);
|
|
|
+ order_len = BN_num_bytes(data->grp->order);
|
|
|
+
|
|
|
+ if (payload_len != 2 * prime_len + order_len) {
|
|
|
+ wpa_printf(MSG_INFO,
|
|
|
+ "EAP-pwd: Unexpected Commit payload length %u (expected %u)",
|
|
|
+ (unsigned int) payload_len,
|
|
|
+ (unsigned int) (2 * prime_len + order_len));
|
|
|
+ goto fin;
|
|
|
+ }
|
|
|
|
|
|
if (((data->private_value = BN_new()) == NULL) ||
|
|
|
((data->my_element = EC_POINT_new(data->grp->group)) == NULL) ||
|
|
@@ -554,6 +571,18 @@ eap_pwd_perform_confirm_exchange(struct eap_sm *sm, struct eap_pwd_data *data,
|
|
|
u8 conf[SHA256_MAC_LEN], *cruft = NULL, *ptr;
|
|
|
int offset;
|
|
|
|
|
|
+ if (data->state != PWD_Confirm_Req) {
|
|
|
+ ret->ignore = TRUE;
|
|
|
+ goto fin;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (payload_len != SHA256_MAC_LEN) {
|
|
|
+ wpa_printf(MSG_INFO,
|
|
|
+ "EAP-pwd: Unexpected Confirm payload length %u (expected %u)",
|
|
|
+ (unsigned int) payload_len, SHA256_MAC_LEN);
|
|
|
+ goto fin;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
* first build up the ciphersuite which is group | random_function |
|
|
|
* prf
|