#include "nattraversal.h"
#include "grabmyaddr.h"
#include "localconf.h"
+#include "crypto_openssl.h"
int
isakmp_sendfrags(iph1, buf)
size_t max_datalen;
size_t fraglen;
vchar_t *frag;
- unsigned int trailer;
unsigned int fragnum = 0;
size_t len;
int etype;
/* select the socket to be sent */
- s = getsockmyaddr(iph1->local);
+ s = getsockmyaddr((struct sockaddr *)iph1->local);
if (s == -1){
return -1;
}
vfree(frag);
return -1;
}
- *(u_int32_t *)vbuf->v = 0; // non-esp marker
+ *ALIGNED_CAST(u_int32_t *)vbuf->v = 0; // non-esp marker
memcpy(vbuf->v + extralen, frag->v, frag->l);
vfree(frag);
frag = vbuf;
int *hp;
int hashlen_bytes = eay_md5_hashlen() >> 3;
- hp = (int *)(gen + 1);
+ hp = ALIGNED_CAST(int *)(gen + 1);
return ntohl(hp[hashlen_bytes / sizeof(*hp)]);
}
struct isakmp_frag *frag;
struct isakmp_frag_item *item;
vchar_t *buf;
- size_t len;
int last_frag = 0;
char *data;
int i;
vchar_t *buf;
int cap;
{
- int *capp;
+ int val, *capp;
size_t len;
int hashlen_bytes = eay_md5_hashlen() >> 3;
"Cannot allocate memory\n");
return NULL;
}
- capp = (int *)(buf->v + len);
- *capp = htonl(0);
- }
-
- capp = (int *)(buf->v + hashlen_bytes);
- *capp |= htonl(cap);
-
+ val = 0;
+ memcpy(buf->v + len, &val, sizeof(val)); // Wcast_lign fix - copy instead of assign for unaligned move
+ }
+ capp = (int *)(void*)(buf->v + hashlen_bytes); // Wcast_lign fix - copy instead of assign for unaligned move
+ memcpy(&val, capp, sizeof(val));
+ val |= htonl(cap);
+ memcpy(capp, &val, sizeof(val));
+
return buf;
}
sendfragsfromto(s, buf, local, remote, count_persend, frag_flags)
int s;
vchar_t *buf;
- struct sockaddr *local;
- struct sockaddr *remote;
+ struct sockaddr_storage *local;
+ struct sockaddr_storage *remote;
int count_persend;
u_int32_t frag_flags;
{
size_t max_datalen;
size_t fraglen;
vchar_t *frag;
- unsigned int trailer;
unsigned int fragnum = 0;
size_t len;
#ifdef ENABLE_NATT
vfree(frag);
return -1;
}
- *(u_int32_t *)vbuf->v = 0; // non-esp marker
+ *ALIGNED_CAST(u_int32_t *)vbuf->v = 0; // non-esp marker
memcpy(vbuf->v + extralen, frag->v, frag->l);
vfree(frag);
frag = vbuf;