huangcm
2024-12-18 9d29be7f7249789d6ffd0440067187a9f040c2cd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/*
 * IKEv2 initiator (RFC 4306) for EAP-IKEV2
 * Copyright (c) 2007, Jouni Malinen <j@w1.fi>
 *
 * This software may be distributed under the terms of the BSD license.
 * See README for more details.
 */
 
#ifndef IKEV2_H
#define IKEV2_H
 
#include "eap_common/ikev2_common.h"
 
struct ikev2_proposal_data {
   u8 proposal_num;
   int integ;
   int prf;
   int encr;
   int dh;
};
 
 
struct ikev2_initiator_data {
   enum { SA_INIT, SA_AUTH, CHILD_SA, IKEV2_DONE } state;
   u8 i_spi[IKEV2_SPI_LEN];
   u8 r_spi[IKEV2_SPI_LEN];
   u8 i_nonce[IKEV2_NONCE_MAX_LEN];
   size_t i_nonce_len;
   u8 r_nonce[IKEV2_NONCE_MAX_LEN];
   size_t r_nonce_len;
   struct wpabuf *r_dh_public;
   struct wpabuf *i_dh_private;
   struct ikev2_proposal_data proposal;
   const struct dh_group *dh;
   struct ikev2_keys keys;
   u8 *IDi;
   size_t IDi_len;
   u8 *IDr;
   size_t IDr_len;
   u8 IDr_type;
   struct wpabuf *r_sign_msg;
   struct wpabuf *i_sign_msg;
   u8 *shared_secret;
   size_t shared_secret_len;
   enum { PEER_AUTH_CERT, PEER_AUTH_SECRET } peer_auth;
   u8 *key_pad;
   size_t key_pad_len;
 
   const u8 * (*get_shared_secret)(void *ctx, const u8 *IDr,
                   size_t IDr_len, size_t *secret_len);
   void *cb_ctx;
   int unknown_user;
};
 
 
void ikev2_initiator_deinit(struct ikev2_initiator_data *data);
int ikev2_initiator_process(struct ikev2_initiator_data *data,
               const struct wpabuf *buf);
struct wpabuf * ikev2_initiator_build(struct ikev2_initiator_data *data);
 
#endif /* IKEV2_H */