1 /* $OpenBSD: common.c,v 1.4 2019/11/14 18:40:23 tobhe 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 const char * 80 ikev2_ikesa_info(uint64_t spi, const char *msg) 81 { 82 return ""; 83 } 84 85 struct iked_childsa * 86 childsa_lookup(struct iked_sa *a, u_int64_t b, u_int8_t c) 87 { 88 return (NULL); 89 } 90 91 int 92 ikev2_childsa_delete(struct iked *a, struct iked_sa *b, u_int8_t c, 93 u_int64_t d, u_int64_t *e , int f) 94 { 95 return (0); 96 } 97 98 int 99 sa_stateok(struct iked_sa *a, int b) 100 { 101 return (0); 102 } 103 104 void 105 sa_state(struct iked * a, struct iked_sa *b, int c) 106 { 107 } 108 109 void 110 ikev2_disable_rekeying(struct iked *a, struct iked_sa *b) 111 { 112 } 113 114 void 115 ikev2_init_ike_sa(struct iked *a, void *b) 116 { 117 } 118 119 const struct group_id * 120 group_getid(u_int32_t id) 121 { 122 return (NULL); 123 } 124 125 void 126 timer_set(struct iked *env, struct iked_timer *tmr, 127 void (*cb)(struct iked *, void *), void *arg) 128 { 129 } 130 131 void 132 timer_add(struct iked *env, struct iked_timer *tmr, int timeout) 133 { 134 } 135 136 void 137 timer_del(struct iked *env, struct iked_timer *tmr) 138 { 139 } 140 141 ssize_t 142 ikev2_nat_detection(struct iked *env, struct iked_message *msg, 143 void *ptr, size_t len, u_int type) 144 { 145 return (0); 146 } 147 148 int 149 ca_setreq(struct iked *env, struct iked_sa *sh, 150 struct iked_static_id *localid, u_int8_t type, u_int8_t *data, 151 size_t len, enum privsep_procid procid) 152 { 153 return (0); 154 } 155 156 int 157 ikev2_print_id(struct iked_id *id, char *idstr, size_t idstrlen) 158 { 159 return (0); 160 } 161 162 struct iked_transform * 163 config_add_transform(struct iked_proposal *prop, u_int type, 164 u_int id, u_int length, u_int keylength) 165 { 166 return (NULL); 167 } 168 169 struct iked_proposal * 170 config_add_proposal(struct iked_proposals *head, u_int id, u_int proto) 171 { 172 return (NULL); 173 } 174 175 void config_free_fragments(struct iked_frag *frag) 176 { 177 return; 178 } 179 180 int 181 ikev2_send_informational(struct iked *env, struct iked_message *msg) 182 { 183 return (0); 184 } 185 186 struct ibuf * 187 ikev2_msg_decrypt(struct iked *env, struct iked_sa *sa, 188 struct ibuf *msg, struct ibuf *src) 189 { 190 ASSERT_PTR_NE(src, NULL); 191 192 /* 193 * Free src as caller uses ikev2_msg_decrypt() like this: 194 * src = ikev2_msg_decrypt(..., src); 195 */ 196 ibuf_free(src); 197 return (NULL); 198 } 199 200 void 201 ikev2_ike_sa_setreason(struct iked_sa *sa, char *r) 202 { 203 } 204