1 /* $OpenBSD: common.c,v 1.2 2019/05/11 16:30:23 patrick Exp $ */ 2 /* 3 * A bunch of stub functions so we can compile and link ikev2_pld.c 4 * in a standalone program for testing purposes. 5 * 6 * Placed in the public domain 7 */ 8 9 #include <sys/socket.h> 10 #include <sys/param.h> 11 #include <sys/time.h> 12 #include <sys/uio.h> 13 14 #include <event.h> 15 #include <limits.h> 16 17 #include "iked.h" 18 #include "types.h" 19 #include "test_helper.h" 20 21 int eap_parse(struct iked *, struct iked_sa *, void *, int); 22 int ikev2_msg_frompeer(struct iked_message *); 23 int ikev2_send_ike_e(struct iked *, struct iked_sa *, struct ibuf *, 24 u_int8_t, u_int8_t, int); 25 void ikev2_ikesa_recv_delete(struct iked *, struct iked_sa *); 26 struct iked_childsa * 27 childsa_lookup(struct iked_sa *, u_int64_t, u_int8_t); 28 int ikev2_childsa_delete(struct iked *, struct iked_sa *, 29 u_int8_t, u_int64_t, u_int64_t *, int); 30 int sa_stateok(struct iked_sa *, int); 31 void sa_state(struct iked *, struct iked_sa *, int); 32 void ikev2_disable_rekeying(struct iked *, struct iked_sa *); 33 void ikev2_init_ike_sa(struct iked *, void *); 34 struct group * 35 group_get(u_int32_t); 36 void timer_set(struct iked *, struct iked_timer *, 37 void (*)(struct iked *, void *), void *); 38 void timer_add(struct iked *, struct iked_timer *, int); 39 void timer_del(struct iked *, struct iked_timer *); 40 ssize_t ikev2_nat_detection(struct iked *, struct iked_message *, 41 void *, size_t, u_int); 42 int ca_setreq(struct iked *, struct iked_sa *, struct iked_static_id *, 43 u_int8_t, u_int8_t *, size_t, enum privsep_procid); 44 int ikev2_print_id(struct iked_id *, char *, size_t); 45 struct iked_transform * 46 config_add_transform(struct iked_proposal *, u_int, u_int, u_int, 47 u_int); 48 struct iked_proposal * 49 config_add_proposal(struct iked_proposals *, u_int, u_int); 50 int ikev2_send_informational(struct iked *, struct iked_message *); 51 struct ibuf * 52 ikev2_msg_decrypt(struct iked *, struct iked_sa *, struct ibuf *, 53 struct ibuf *); 54 55 int 56 eap_parse(struct iked *env, struct iked_sa *sa, void *data, int response) 57 { 58 return (0); 59 } 60 61 int 62 ikev2_msg_frompeer(struct iked_message *msg) 63 { 64 return (0); 65 } 66 67 int 68 ikev2_send_ike_e(struct iked *env, struct iked_sa *sa, struct ibuf *buf, 69 u_int8_t firstpayload, u_int8_t exchange, int response) 70 { 71 return (0); 72 } 73 74 void 75 ikev2_ikesa_recv_delete(struct iked *env, struct iked_sa *sa) 76 { 77 } 78 79 struct iked_childsa * 80 childsa_lookup(struct iked_sa *a, u_int64_t b, u_int8_t c) 81 { 82 return (NULL); 83 } 84 85 int 86 ikev2_childsa_delete(struct iked *a, struct iked_sa *b, u_int8_t c, 87 u_int64_t d, u_int64_t *e , int f) 88 { 89 return (0); 90 } 91 92 int 93 sa_stateok(struct iked_sa *a, int b) 94 { 95 return (0); 96 } 97 98 void 99 sa_state(struct iked * a, struct iked_sa *b, int c) 100 { 101 } 102 103 void 104 ikev2_disable_rekeying(struct iked *a, struct iked_sa *b) 105 { 106 } 107 108 void 109 ikev2_init_ike_sa(struct iked *a, void *b) 110 { 111 } 112 113 const struct group_id * 114 group_getid(u_int32_t id) 115 { 116 return (NULL); 117 } 118 119 void 120 timer_set(struct iked *env, struct iked_timer *tmr, 121 void (*cb)(struct iked *, void *), void *arg) 122 { 123 } 124 125 void 126 timer_add(struct iked *env, struct iked_timer *tmr, int timeout) 127 { 128 } 129 130 void 131 timer_del(struct iked *env, struct iked_timer *tmr) 132 { 133 } 134 135 ssize_t 136 ikev2_nat_detection(struct iked *env, struct iked_message *msg, 137 void *ptr, size_t len, u_int type) 138 { 139 return (0); 140 } 141 142 int 143 ca_setreq(struct iked *env, struct iked_sa *sh, 144 struct iked_static_id *localid, u_int8_t type, u_int8_t *data, 145 size_t len, enum privsep_procid procid) 146 { 147 return (0); 148 } 149 150 int 151 ikev2_print_id(struct iked_id *id, char *idstr, size_t idstrlen) 152 { 153 return (0); 154 } 155 156 struct iked_transform * 157 config_add_transform(struct iked_proposal *prop, u_int type, 158 u_int id, u_int length, u_int keylength) 159 { 160 return (NULL); 161 } 162 163 struct iked_proposal * 164 config_add_proposal(struct iked_proposals *head, u_int id, u_int proto) 165 { 166 return (NULL); 167 } 168 169 void config_free_fragments(struct iked_frag *frag) 170 { 171 return; 172 } 173 174 int 175 ikev2_send_informational(struct iked *env, struct iked_message *msg) 176 { 177 return (0); 178 } 179 180 struct ibuf * 181 ikev2_msg_decrypt(struct iked *env, struct iked_sa *sa, 182 struct ibuf *msg, struct ibuf *src) 183 { 184 ASSERT_PTR_NE(src, NULL); 185 186 /* 187 * Free src as caller uses ikev2_msg_decrypt() like this: 188 * src = ikev2_msg_decrypt(..., src); 189 */ 190 ibuf_free(src); 191 return (NULL); 192 } 193