Committer: Miika Komu <miika@xxxxxx> Date: 19/03/2010 at 11:23:49 Revision: 3798 Revision-id: miika@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Branch nick: release-1.0.5 Log: Syncronized to trunk revisions 3813..3814 Modified: M firewall/conntrack.c M firewall/firewalldb.c M firewall/firewalldb.h M firewall/lsi.c M firewall/pisa.c M firewall/proxy.c M hipd/blind.c M hipd/cert.c M hipd/cookie.c M hipd/dh.c M hipd/dh.h M hipd/hadb.h M hipd/hidb.c M hipd/icookie.c M hipd/input.c M hipd/input.h M hipd/keymat.c M hipd/keymat.h M hipd/netdev.c M hipd/output.c M hipd/pfkeyapi.c M hipd/user.c M lib/core/builder.c M lib/core/builder.h M lib/core/crypto.c M lib/core/crypto.h M lib/core/misc.c M lib/core/misc.h M lib/core/state.h M lib/tool/nlink.c M lib/tool/nlink.h M lib/tool/pk.c M lib/tool/xfrmapi.c M lib/tool/xfrmapi.h M test/dh_performance.c === modified file 'firewall/conntrack.c' --- firewall/conntrack.c 2010-02-17 17:38:08 +0000 +++ firewall/conntrack.c 2010-03-19 09:24:10 +0000 @@ -1074,7 +1074,7 @@ { struct hip_relay_to *relay_to; struct iphdr *iph = (struct iphdr *) ctx->ipq_packet->payload; - struct udphdr *udph = (struct udphdr *) ((u8 *) iph + iph->ihl * 4); + struct udphdr *udph = (struct udphdr *) ((uint8_t *) iph + iph->ihl * 4); int err = 0; relay_to = hip_get_param(common, HIP_PARAM_RELAY_TO); @@ -1975,7 +1975,7 @@ const struct tuple *tuple) { struct iphdr *iph = (struct iphdr *) ctx->ipq_packet->payload; - struct udphdr *udph = (struct udphdr *) ((u8 *) iph + iph->ihl * 4); + struct udphdr *udph = (struct udphdr *) ((uint8_t *) iph + iph->ihl * 4); int len = ctx->ipq_packet->data_len - iph->ihl * 4; int err = 0; @@ -2008,7 +2008,7 @@ HIP_DEBUG("Relaying packet\n"); hip_firewall_send_outgoing_pkt(&ctx->dst, tuple->dst_ip, - (u8 *) iph + iph->ihl * 4, len, iph->protocol); + (uint8_t *) iph + iph->ihl * 4, len, iph->protocol); out_err: return err; } === modified file 'firewall/firewalldb.c' --- firewall/firewalldb.c 2010-03-03 13:16:18 +0000 +++ firewall/firewalldb.c 2010-03-19 09:24:10 +0000 @@ -598,7 +598,7 @@ */ int hip_firewall_send_incoming_pkt(const struct in6_addr *src_hit, const struct in6_addr *dst_hit, - u8 *msg, u16 len, + uint8_t *msg, uint16_t len, int proto, int ttl) { @@ -658,10 +658,10 @@ udp->check = htons(0); udp->check = ipv4_checksum(IPPROTO_UDP, - (u8 *) &(sock_src4->sin_addr), - (u8 *) &(sock_dst4->sin_addr), - (u8 *) udp, len); - memmove((msg + sizeof(struct ip)), (u8 *) udp, len); + (uint8_t *) &(sock_src4->sin_addr), + (uint8_t *) &(sock_dst4->sin_addr), + (uint8_t *) udp, len); + memmove((msg + sizeof(struct ip)), (uint8_t *) udp, len); } break; case IPPROTO_TCP: @@ -679,14 +679,14 @@ firewall_raw_sock = firewall_raw_sock_tcp_v4; tcp->check = ipv4_checksum(IPPROTO_TCP, - (u8 *) &(sock_src4->sin_addr), - (u8 *) &(sock_dst4->sin_addr), - (u8 *) tcp, len); + (uint8_t *) &(sock_src4->sin_addr), + (uint8_t *) &(sock_dst4->sin_addr), + (uint8_t *) tcp, len); _HIP_DEBUG("checksum %x, len=%d\n", htons(tcp->check), len); _HIP_DEBUG_LSI("src", &(sock_src4->sin_addr)); _HIP_DEBUG_LSI("dst", &(sock_dst4->sin_addr)); - memmove((char *) (msg + sizeof(struct ip)), (u8 *) tcp, len); + memmove((char *) (msg + sizeof(struct ip)), (uint8_t *) tcp, len); } break; case IPPROTO_ICMP: @@ -694,7 +694,7 @@ icmp = (struct icmphdr *) msg; icmp->checksum = htons(0); icmp->checksum = inchksum(icmp, len); - memmove((char *) (msg + sizeof(struct ip)), (u8 *) icmp, len); + memmove((char *) (msg + sizeof(struct ip)), (uint8_t *) icmp, len); _HIP_DEBUG("icmp->type = %d\n", icmp->type); _HIP_DEBUG("icmp->code = %d\n", icmp->code); break; @@ -773,7 +773,7 @@ */ int hip_firewall_send_outgoing_pkt(const struct in6_addr *src_hit, const struct in6_addr *dst_hit, - u8 *msg, u16 len, + uint8_t *msg, uint16_t len, int proto) { int err = 0, sent, sa_size; @@ -825,8 +825,8 @@ } else { firewall_raw_sock = firewall_raw_sock_tcp_v4; ((struct tcphdr *) msg)->check - = ipv4_checksum(IPPROTO_TCP, (u8 *) &(sock_src4->sin_addr), - (u8 *) &(sock_dst4->sin_addr), msg, len); + = ipv4_checksum(IPPROTO_TCP, (uint8_t *) &(sock_src4->sin_addr), + (uint8_t *) &(sock_dst4->sin_addr), msg, len); } break; case IPPROTO_UDP: @@ -843,8 +843,8 @@ } else { firewall_raw_sock = firewall_raw_sock_udp_v4; ((struct udphdr *) msg)->check - = ipv4_checksum(IPPROTO_UDP, (u8 *) &(sock_src4->sin_addr), - (u8 *) &(sock_dst4->sin_addr), msg, len); + = ipv4_checksum(IPPROTO_UDP, (uint8_t *) &(sock_src4->sin_addr), + (uint8_t *) &(sock_dst4->sin_addr), msg, len); } break; case IPPROTO_ICMP: === modified file 'firewall/firewalldb.h' --- firewall/firewalldb.h 2010-02-17 17:38:08 +0000 +++ firewall/firewalldb.h 2010-03-19 09:24:10 +0000 @@ -19,10 +19,10 @@ int state); int hip_firewall_send_outgoing_pkt(const struct in6_addr *src_hit, const struct in6_addr *dst_hit, - u8 *msg, u16 len, + uint8_t *msg, uint16_t len, int proto); int hip_firewall_send_incoming_pkt(const struct in6_addr *src_hit, const struct in6_addr *dst_hit, - u8 *msg, u16 len, int proto, int ttl); + uint8_t *msg, uint16_t len, int proto, int ttl); #endif /* HIP_FIREWALL_FIREWALLDB_H */ === modified file 'firewall/lsi.c' --- firewall/lsi.c 2010-03-03 13:16:18 +0000 +++ firewall/lsi.c 2010-03-19 09:24:10 +0000 @@ -380,7 +380,7 @@ int packet_length = 0; int protocol = 0; int ttl = 0; - u8 *msg = NULL; + uint8_t *msg = NULL; struct icmphdr *icmp = NULL; if (ipOrigTraffic == 4) { @@ -416,7 +416,7 @@ /* Note: using calloc to zero memory region here because I think * firewall_send_incoming_pkt() calculates checksum * from too long region sometimes. See bug id 874 */ - msg = (u8 *) calloc((packet_length + sizeof(struct ip)), 1); + msg = (uint8_t *) calloc((packet_length + sizeof(struct ip)), 1); memcpy(msg, (m->payload) + ip_hdr_size, packet_length); if (protocol == IPPROTO_ICMP && incoming) { === modified file 'firewall/pisa.c' --- firewall/pisa.c 2010-02-18 12:26:08 +0000 +++ firewall/pisa.c 2010-03-19 09:24:10 +0000 @@ -124,7 +124,7 @@ static int pisa_append_hmac(struct in6_addr *hit1, struct in6_addr *hit2, int rnd, void *data, int data_len) { - u8 key[32 + PISA_RANDOM_LEN]; + uint8_t key[32 + PISA_RANDOM_LEN]; int err = 0; unsigned int len = HIP_AH_SHA_LEN; === modified file 'firewall/proxy.c' --- firewall/proxy.c 2010-03-03 13:16:18 +0000 +++ firewall/proxy.c 2010-03-19 09:24:10 +0000 @@ -417,7 +417,7 @@ static int hip_proxy_send_pkt(struct in6_addr *local_addr, struct in6_addr *peer_addr, - u8 *msg, u16 len, int protocol) + uint8_t *msg, uint16_t len, int protocol) { int err = 0, sa_size, sent; struct sockaddr_storage src, dst; @@ -528,8 +528,8 @@ HIP_DEBUG("TCP packet\n"); ((struct tcphdr *) msg)->check = ipv4_checksum( IPPROTO_TCP, - (u8 *) (&(src4->sin_addr)), - (u8 *) (&(dst4->sin_addr)), + (uint8_t *) (&(src4->sin_addr)), + (uint8_t *) (&(dst4->sin_addr)), msg, len); //checksum is ok for ipv4 } else { HIP_DEBUG("src_addr and dst_aadr are ipv6!\n"); @@ -549,8 +549,8 @@ HIP_DEBUG("src_addr and dst_aadr are ipv4!\n"); HIP_DEBUG("UDP packet\n"); ((struct udphdr *) msg)->check = ipv4_checksum( - IPPROTO_UDP, (u8 *) (&(src4->sin_addr)), - (u8 *) (&(dst4->sin_addr)), + IPPROTO_UDP, (uint8_t *) (&(src4->sin_addr)), + (uint8_t *) (&(dst4->sin_addr)), msg, len); //checksum is ok for ipv4 } else { HIP_DEBUG("src_addr and dst_aadr are ipv6!\n"); @@ -622,7 +622,7 @@ static int hip_proxy_send_to_client_pkt(struct in6_addr *local_addr, struct in6_addr *peer_addr, - u8 *buff, u16 len) + uint8_t *buff, uint16_t len) { int on = 1, off = 0, protocol, err = 0, sa_size = 0, sent; struct sockaddr_storage src, dst; @@ -639,7 +639,7 @@ struct udphdr *udp = NULL; struct icmphdr *icmp = NULL; struct icmp6_hdr *icmpv6 = NULL; - u8 *msg = NULL; + uint8_t *msg = NULL; /* Points either to v4 or v6 raw sock */ int hip_raw_sock = 0; @@ -711,37 +711,37 @@ if (protocol == IPPROTO_TCP) { hip_raw_sock = hip_proxy_raw_sock_tcp_v4; sa_size = sizeof(struct sockaddr_in); - msg = (u8 *) HIP_MALLOC((len - sizeof(struct ip6_hdr) + sizeof(struct ip)), 0); + msg = (uint8_t *) HIP_MALLOC((len - sizeof(struct ip6_hdr) + sizeof(struct ip)), 0); memset(msg, 0, (len - sizeof(struct ip6_hdr) + sizeof(struct ip))); HIP_DEBUG_INADDR("ipv4 src address inbound: ", &src4->sin_addr); HIP_DEBUG_INADDR("ipv4 src address inbound: ", &dst4->sin_addr); tcp->check = htons(0); - tcp->check = ipv4_checksum(IPPROTO_TCP, (u8 *) (&(src4->sin_addr)), (u8 *) (&(dst4->sin_addr)), (u8 *) tcp, (len - sizeof(struct ip6_hdr))); //checksum is ok for ipv4 + tcp->check = ipv4_checksum(IPPROTO_TCP, (uint8_t *) (&(src4->sin_addr)), (uint8_t *) (&(dst4->sin_addr)), (uint8_t *) tcp, (len - sizeof(struct ip6_hdr))); //checksum is ok for ipv4 HIP_HEXDUMP("tcp dump: ", tcp, (len - sizeof(struct ip6_hdr))); - memcpy((msg + sizeof(struct ip)), (u8 *) tcp, (len - sizeof(struct ip6_hdr))); + memcpy((msg + sizeof(struct ip)), (uint8_t *) tcp, (len - sizeof(struct ip6_hdr))); HIP_HEXDUMP("tcp msg dump: ", msg, (len - sizeof(struct ip6_hdr) + sizeof(struct ip))); } if (protocol == IPPROTO_UDP) { hip_raw_sock = hip_proxy_raw_sock_udp_v4; sa_size = sizeof(struct sockaddr_in); - msg = (u8 *) HIP_MALLOC((len - sizeof(struct ip6_hdr) + sizeof(struct ip)), 0); + msg = (uint8_t *) HIP_MALLOC((len - sizeof(struct ip6_hdr) + sizeof(struct ip)), 0); memset(msg, 0, (len - sizeof(struct ip6_hdr) + sizeof(struct ip))); HIP_DEBUG_INADDR("ipv4 src address inbound: ", &src4->sin_addr); HIP_DEBUG_INADDR("ipv4 src address inbound: ", &dst4->sin_addr); udp->check = htons(0); - udp->check = ipv4_checksum(IPPROTO_UDP, (u8 *) (&(src4->sin_addr)), (u8 *) (&(dst4->sin_addr)), (u8 *) udp, (len - sizeof(struct ip6_hdr))); //checksum is ok for ipv4 + udp->check = ipv4_checksum(IPPROTO_UDP, (uint8_t *) (&(src4->sin_addr)), (uint8_t *) (&(dst4->sin_addr)), (uint8_t *) udp, (len - sizeof(struct ip6_hdr))); //checksum is ok for ipv4 HIP_HEXDUMP("udp dump: ", udp, (len - sizeof(struct ip6_hdr))); - memcpy((msg + sizeof(struct ip)), (u8 *) udp, (len - sizeof(struct ip6_hdr))); + memcpy((msg + sizeof(struct ip)), (uint8_t *) udp, (len - sizeof(struct ip6_hdr))); HIP_HEXDUMP("udp msg dump: ", msg, (len - sizeof(struct ip6_hdr) + sizeof(struct ip))); } if (protocol == IPPROTO_ICMP) { hip_raw_sock = hip_proxy_raw_sock_icmp_v4; sa_size = sizeof(struct sockaddr_in); - msg = (u8 *) HIP_MALLOC((len - sizeof(struct ip6_hdr) + sizeof(struct ip)), 0); + msg = (uint8_t *) HIP_MALLOC((len - sizeof(struct ip6_hdr) + sizeof(struct ip)), 0); memset(msg, 0, (len - sizeof(struct ip6_hdr) + sizeof(struct ip))); HIP_DEBUG_INADDR("ipv4 src address inbound: ", &src4->sin_addr); @@ -750,7 +750,7 @@ //icmp->checksum = ipv4_checksum(IPPROTO_ICMP, &(src4->sin_addr), &(dst4->sin_addr), icmp, (len - sizeof(struct ip6_hdr))); //checksum is ok for ipv4 icmp->checksum = inchksum(icmp, (len - sizeof(struct ip6_hdr))); //checksum is ok for ipv4 HIP_HEXDUMP("icmp dump: ", icmp, (len - sizeof(struct ip6_hdr))); - memcpy((msg + sizeof(struct ip)), (u8 *) icmp, (len - sizeof(struct ip6_hdr))); + memcpy((msg + sizeof(struct ip)), (uint8_t *) icmp, (len - sizeof(struct ip6_hdr))); HIP_HEXDUMP("icmp msg dump: ", msg, (len - sizeof(struct ip6_hdr) + sizeof(struct ip))); } } else { @@ -758,33 +758,33 @@ HIP_DEBUG("Using IPv6 raw socket (TCP)\n"); hip_raw_sock = hip_proxy_raw_sock_tcp_v6; sa_size = sizeof(struct sockaddr_in6); - msg = (u8 *) HIP_MALLOC(len, 0); + msg = (uint8_t *) HIP_MALLOC(len, 0); //memset(msg, 0, len); tcp->check = htons(0); tcp->check = ipv6_checksum(IPPROTO_TCP, &(src6->sin6_addr), &(dst6->sin6_addr), tcp, (len - sizeof(struct ip6_hdr))); //checksum is ok for ipv6 - memcpy((msg + sizeof(struct ip6_hdr)), (u8 *) tcp, (len - sizeof(struct ip6_hdr))); + memcpy((msg + sizeof(struct ip6_hdr)), (uint8_t *) tcp, (len - sizeof(struct ip6_hdr))); } if (protocol == IPPROTO_UDP) { HIP_DEBUG("Using IPv6 raw socket (UDP)\n"); hip_raw_sock = hip_proxy_raw_sock_udp_v6; sa_size = sizeof(struct sockaddr_in6); - msg = (u8 *) HIP_MALLOC(len, 0); + msg = (uint8_t *) HIP_MALLOC(len, 0); //memset(msg, 0, len); udp->check = htons(0); udp->check = ipv6_checksum(IPPROTO_UDP, &(src6->sin6_addr), &(dst6->sin6_addr), udp, (len - sizeof(struct ip6_hdr))); //checksum is ok for ipv6 - memcpy((msg + sizeof(struct ip6_hdr)), (u8 *) udp, (len - sizeof(struct ip6_hdr))); + memcpy((msg + sizeof(struct ip6_hdr)), (uint8_t *) udp, (len - sizeof(struct ip6_hdr))); } if (protocol == IPPROTO_ICMPV6) { HIP_DEBUG("Using IPv6 raw socket (ICMPV6)\n"); hip_raw_sock = hip_proxy_raw_sock_icmp_v6; sa_size = sizeof(struct sockaddr_in6); - msg = (u8 *) HIP_MALLOC(len, 0); + msg = (uint8_t *) HIP_MALLOC(len, 0); //memset(msg, 0, len); icmpv6->icmp6_cksum = htons(0); icmpv6->icmp6_cksum = ipv6_checksum(IPPROTO_ICMPV6, &(src6->sin6_addr), &(dst6->sin6_addr), icmpv6, (len - sizeof(struct ip6_hdr))); //checksum is ok for ipv6 - memcpy((msg + sizeof(struct ip6_hdr)), (u8 *) icmpv6, (len - sizeof(struct ip6_hdr))); + memcpy((msg + sizeof(struct ip6_hdr)), (uint8_t *) icmpv6, (len - sizeof(struct ip6_hdr))); } } @@ -956,7 +956,7 @@ HIP_DEBUG("We are translating esp packet!\n"); HIP_DEBUG_IN6ADDR("inbound address 1:", &conn_entry->addr_peer); HIP_DEBUG_IN6ADDR("inbound address 2:", &conn_entry->addr_client); - hip_proxy_send_to_client_pkt(&conn_entry->addr_peer, &conn_entry->addr_client, (u8 *) ipheader, m->data_len); + hip_proxy_send_to_client_pkt(&conn_entry->addr_peer, &conn_entry->addr_client, (uint8_t *) ipheader, m->data_len); /* drop packet */ err = 0; } @@ -975,7 +975,7 @@ return err; } -static int hip_proxy_send_inbound_icmp_pkt(struct in6_addr *src_addr, struct in6_addr *dst_addr, u8 *buff, u16 len) +static int hip_proxy_send_inbound_icmp_pkt(struct in6_addr *src_addr, struct in6_addr *dst_addr, uint8_t *buff, uint16_t len) { struct sockaddr_in6 src6, dst6; struct ip *ip; @@ -983,7 +983,7 @@ struct icmphdr *icmp; int sa_size, sent; int on = 1; - u8 *msg; + uint8_t *msg; ip = (struct ip *) buff; @@ -1000,7 +1000,7 @@ HIP_DEBUG_IN6ADDR("dst6", &dst6.sin6_addr); sa_size = sizeof(struct sockaddr_in6); - msg = (u8 *) HIP_MALLOC((len + sizeof(struct ip6_hdr) - ip->ip_hl), 0); + msg = (uint8_t *) HIP_MALLOC((len + sizeof(struct ip6_hdr) - ip->ip_hl), 0); memset(msg, 0, (len + sizeof(struct ip6_hdr) - ip->ip_hl)); ip6 = (struct ip6_hdr *) msg; @@ -1010,7 +1010,7 @@ ip6->ip6_dst = dst6.sin6_addr; - memcpy((msg + sizeof(struct ip6_hdr)), (u8 *) icmp, (len - ip->ip_hl)); + memcpy((msg + sizeof(struct ip6_hdr)), (uint8_t *) icmp, (len - ip->ip_hl)); icmp->checksum = htons(0); icmp->checksum = inchksum(icmp, (len - ip->ip_hl)); //checksum is ok for ipv4 @@ -1110,7 +1110,7 @@ err = 0; } else if (entry->state == HIP_PROXY_TRANSLATE) { int packet_length = 0; - u8 *msg; + uint8_t *msg; //TODO: check the connection with same ip but different port, should be added into conndb @@ -1141,12 +1141,12 @@ } if ((protocol == IPPROTO_ICMP) || (protocol == IPPROTO_ICMPV6)) { - hip_proxy_send_inbound_icmp_pkt(proxy_hit, &entry->hit_peer, (u8 *) m->payload, m->data_len); + hip_proxy_send_inbound_icmp_pkt(proxy_hit, &entry->hit_peer, (uint8_t *) m->payload, m->data_len); /* drop packet */ err = 0; } else { packet_length = m->data_len - hdr_size; - msg = (u8 *) HIP_MALLOC(packet_length, 0); + msg = (uint8_t *) HIP_MALLOC(packet_length, 0); memcpy(msg, (m->payload) + hdr_size, packet_length); === modified file 'hipd/blind.c' --- hipd/blind.c 2010-02-17 17:38:08 +0000 +++ hipd/blind.c 2010-03-19 09:24:10 +0000 @@ -162,7 +162,7 @@ int hip_do_blind(char *key, unsigned int key_len, struct in6_addr *blind_hit) { int err = 0; - u8 digest[HIP_AH_SHA_LEN]; + uint8_t digest[HIP_AH_SHA_LEN]; HIP_DEBUG("\n"); @@ -171,7 +171,7 @@ bzero(blind_hit, sizeof(hip_hit_t)); HIP_IFEL(khi_encode(digest, sizeof(digest) * 8, - ((u8 *) blind_hit) + 3, + ((uint8_t *) blind_hit) + 3, sizeof(hip_hit_t) * 8 - HIP_HIT_PREFIX_LEN), -1, "encoding failed\n"); @@ -494,7 +494,7 @@ hip_common_t *msg = NULL; int err = 0, dh_size1 = 0, dh_size2 = 0, written1 = 0, written2 = 0; int mask = 0; - u8 *dh_data1 = NULL, *dh_data2 = NULL; + uint8_t *dh_data1 = NULL, *dh_data2 = NULL; hip_srv_t service_list[HIP_TOTAL_EXISTING_SERVICES]; unsigned int service_count = 0; === modified file 'hipd/cert.c' --- hipd/cert.c 2010-03-03 13:16:18 +0000 +++ hipd/cert.c 2010-03-19 09:24:10 +0000 @@ -38,7 +38,7 @@ unsigned char *signature_b64 = NULL; unsigned char *digest_b64 = NULL; unsigned char *sha_retval; - u8 *signature = NULL; + uint8_t *signature = NULL; DSA_SIG *dsa_sig = NULL; /* RSA needed variables */ === modified file 'hipd/cookie.c' --- hipd/cookie.c 2010-03-03 13:16:18 +0000 +++ hipd/cookie.c 2010-03-19 09:24:10 +0000 @@ -127,7 +127,7 @@ int hip_calc_cookie_idx(struct in6_addr *ip_i, struct in6_addr *ip_r, struct in6_addr *hit_i) { - register u32 base = 0; + register uint32_t base = 0; int i; for (i = 0; i < 4; i++) { === modified file 'hipd/dh.c' --- hipd/dh.c 2010-02-17 17:38:08 +0000 +++ hipd/dh.c 2010-03-19 09:24:10 +0000 @@ -16,7 +16,7 @@ DH *dh_table[HIP_MAX_DH_GROUP_ID] = {0}; -static void hip_regen_dh_keys(u32 bitmask); +static void hip_regen_dh_keys(uint32_t bitmask); /** * hip_insert_dh - Insert the current DH-key into the buffer @@ -24,7 +24,7 @@ * If a DH-key does not exist, we will create one. * @return >0 if ok, -1 if errors */ -int hip_insert_dh(u8 *buffer, int bufsize, int group_id) +int hip_insert_dh(uint8_t *buffer, int bufsize, int group_id) { size_t res; DH *tmp; @@ -118,7 +118,7 @@ * * Use only this function to generate DH keys. */ -static void hip_regen_dh_keys(u32 bitmask) +static void hip_regen_dh_keys(uint32_t bitmask) { DH *tmp, *okey; int maxmask, i; @@ -162,7 +162,7 @@ int hip_init_cipher(void) { - u32 supported_groups; + uint32_t supported_groups; supported_groups = (1 << HIP_DH_OAKLEY_1 | 1 << HIP_DH_OAKLEY_5 | === modified file 'hipd/dh.h' --- hipd/dh.h 2010-02-17 17:38:08 +0000 +++ hipd/dh.h 2010-03-19 09:24:10 +0000 @@ -4,7 +4,7 @@ #include "hadb.h" #include "lib/core/crypto.h" -int hip_insert_dh(u8 *buffer, int bufsize, int group_id); +int hip_insert_dh(uint8_t *buffer, int bufsize, int group_id); void hip_dh_uninit(void); int hip_calculate_shared_secret(uint8_t *public_value, uint8_t group_id, === modified file 'hipd/hadb.h' --- hipd/hadb.h 2010-02-17 17:38:08 +0000 +++ hipd/hadb.h 2010-03-19 09:24:10 +0000 @@ -42,7 +42,7 @@ /* Matching */ static inline int hip_hadb_match_spi(const void *key_1, const void *key_2) { - return *(const u32 *) key_1 == *(const u32 *) key_2; + return *(const uint32_t *) key_1 == *(const uint32_t *) key_2; } int hip_ha_compare(const hip_ha_t *ha1, const hip_ha_t *ha2); === modified file 'hipd/hidb.c' --- hipd/hidb.c 2010-02-17 17:38:08 +0000 +++ hipd/hidb.c 2010-03-19 09:24:10 +0000 @@ -543,11 +543,11 @@ int key_len; /* T could easily have been an int, since the compiler will * probably add 3 alignment bytes here anyway. */ - u8 T; + uint8_t T; struct hip_host_id *ret; /* check T, Miika won't like this */ - T = *((u8 *) (hi->key)); + T = *((uint8_t *) (hi->key)); if (T > 8) { HIP_ERROR("Invalid T-value in DSA key (0x%x)\n", T); return NULL; === modified file 'hipd/icookie.c' --- hipd/icookie.c 2010-02-17 17:38:08 +0000 +++ hipd/icookie.c 2010-03-19 09:24:10 +0000 @@ -30,7 +30,7 @@ int hip_calc_cookie_idx(struct in6_addr *ip_i, struct in6_addr *ip_r, struct in6_addr *hit_i) { - register u32 base = 0; + register uint32_t base = 0; int i; /* Indexing based on the initiator HIT only: however, this may happen === modified file 'hipd/input.c' --- hipd/input.c 2010-03-03 13:16:18 +0000 +++ hipd/input.c 2010-03-19 09:24:10 +0000 @@ -66,10 +66,10 @@ * @note Fix the packet len before calling this function! */ static int hip_verify_hmac(struct hip_common *buffer, uint16_t buf_len, - u8 *hmac, void *hmac_key, int hmac_type) + uint8_t *hmac, void *hmac_key, int hmac_type) { int err = 0; - u8 hmac_res[HIP_AH_SHA_LEN]; + uint8_t hmac_res[HIP_AH_SHA_LEN]; HIP_HEXDUMP("HMAC data", buffer, buf_len); @@ -102,7 +102,7 @@ int err = 0, len = 0, orig_len = 0; struct hip_crypto_key tmpkey; struct hip_hmac *hmac = NULL; - u8 orig_checksum = 0; + uint8_t orig_checksum = 0; HIP_DEBUG("hip_verify_packet_hmac() invoked.\n"); @@ -117,7 +117,7 @@ orig_checksum = hip_get_msg_checksum(msg); hip_zero_msg_checksum(msg); - len = (u8 *) hmac - (u8 *) msg; + len = (uint8_t *) hmac - (uint8_t *) msg; hip_set_msg_total_len(msg, len); _HIP_HEXDUMP("HMAC key", crypto_key->key, === modified file 'hipd/input.h' --- hipd/input.h 2010-03-03 13:16:18 +0000 +++ hipd/input.h 2010-03-19 09:24:10 +0000 @@ -28,29 +28,29 @@ #include "lib/core/protodefs.h" struct hi3_ipv4_addr { - u8 sin_family; + uint8_t sin_family; struct in_addr sin_addr; }; struct hi3_ipv6_addr { - u8 sin6_family; + uint8_t sin6_family; struct in6_addr sin6_addr; }; struct pseudo_header6 { unsigned char src_addr[16]; unsigned char dst_addr[16]; - u32 packet_length; + uint32_t packet_length; unsigned char zero[3]; - u8 next_hdr; + uint8_t next_hdr; }; struct pseudo_header { unsigned char src_addr[4]; unsigned char dst_addr[4]; - u8 zero; - u8 protocol; - u16 packet_length; + uint8_t zero; + uint8_t protocol; + uint16_t packet_length; }; /** @@ -71,7 +71,7 @@ * @todo If BLIND is in use we should include the BLIND bit * in legal values, shouldn't we? */ -static inline int hip_controls_sane(u16 controls, u16 legal) +static inline int hip_controls_sane(uint16_t controls, uint16_t legal) { _HIP_DEBUG("hip_controls_sane() invoked.\n"); return ((controls & HIP_PACKET_CTRL_ANON) | legal) == legal; === modified file 'hipd/keymat.c' --- hipd/keymat.c 2010-02-17 17:38:08 +0000 +++ hipd/keymat.c 2010-03-19 09:24:10 +0000 @@ -15,24 +15,24 @@ #include "keymat.h" -static u8 *hip_create_keymat_buffer(char *kij, size_t kij_len, size_t hash_len, +static uint8_t *hip_create_keymat_buffer(char *kij, size_t kij_len, size_t hash_len, struct in6_addr *smaller_hit, struct in6_addr *bigger_hit, uint64_t I, uint64_t J) { - u8 *buffer = NULL, *cur = NULL; + uint8_t *buffer = NULL, *cur = NULL; size_t requiredmem; HIP_DEBUG("\n"); /* 2*sizeof(uint64_t) added to take care of I and J. */ if (2 * sizeof(struct in6_addr) < hash_len) { - requiredmem = kij_len + hash_len + sizeof(u8) + 2 * sizeof(uint64_t); + requiredmem = kij_len + hash_len + sizeof(uint8_t) + 2 * sizeof(uint64_t); } else { requiredmem = kij_len + 2 * sizeof(struct in6_addr) + - sizeof(u8) + 2 * sizeof(uint64_t); + sizeof(uint8_t) + 2 * sizeof(uint64_t); } - buffer = (u8 *) HIP_MALLOC(requiredmem, GFP_KERNEL); + buffer = (uint8_t *) HIP_MALLOC(requiredmem, GFP_KERNEL); if (!buffer) { HIP_ERROR("Out of memory\n"); return buffer; @@ -41,24 +41,24 @@ cur = buffer; memcpy(cur, kij, kij_len); cur += kij_len; - memcpy(cur, (u8 *) smaller_hit, sizeof(struct in6_addr)); + memcpy(cur, (uint8_t *) smaller_hit, sizeof(struct in6_addr)); cur += sizeof(struct in6_addr); - memcpy(cur, (u8 *) bigger_hit, sizeof(struct in6_addr)); + memcpy(cur, (uint8_t *) bigger_hit, sizeof(struct in6_addr)); cur += sizeof(struct in6_addr); memcpy(cur, &I, sizeof(uint64_t)); // XX CHECK: network byte order? cur += sizeof(uint64_t); memcpy(cur, &J, sizeof(uint64_t)); // XX CHECK: network byte order? cur += sizeof(uint64_t); *(cur) = 1; - cur += sizeof(u8); + cur += sizeof(uint8_t); _HIP_HEXDUMP("beginning of keymat", buffer, cur - buffer); return buffer; } -static void hip_update_keymat_buffer(u8 *keybuf, u8 *Kold, size_t Kold_len, - size_t Kij_len, u8 cnt) +static void hip_update_keymat_buffer(uint8_t *keybuf, uint8_t *Kold, size_t Kold_len, + size_t Kij_len, uint8_t cnt) { HIP_ASSERT(keybuf); @@ -83,7 +83,7 @@ void hip_make_keymat(char *kij, size_t kij_len, struct hip_keymat_keymat *keymat, void *dstbuf, size_t dstbuflen, struct in6_addr *hit1, - struct in6_addr *hit2, u8 *calc_index, + struct in6_addr *hit2, uint8_t *calc_index, uint64_t I, uint64_t J) { int bufsize; @@ -92,7 +92,7 @@ void *seedkey; struct in6_addr *smaller_hit, *bigger_hit; int hit1_is_bigger; - u8 *shabuffer = NULL; + uint8_t *shabuffer = NULL; HIP_DEBUG("\n"); if (dstbuflen < HIP_AH_SHA_LEN) { @@ -251,7 +251,7 @@ /* must have the hadb lock when calling this function */ int err = 0; int copied = 0; - u8 *tmp_data = NULL; + uint8_t *tmp_data = NULL; size_t tmp_data_len; _HIP_DEBUG("key_len=%d, requested keymat_index=%u calc_index=%u Kn_is_at=%u\n", @@ -307,7 +307,7 @@ _HIP_DEBUG("need %d bytes more data\n", key_len - copied); tmp_data_len = kij_len + HIP_AH_SHA_LEN + 1; - tmp_data = (u8 *) HIP_MALLOC(tmp_data_len, GFP_KERNEL); + tmp_data = (uint8_t *) HIP_MALLOC(tmp_data_len, GFP_KERNEL); if (!tmp_data) { HIP_ERROR("HIP_MALLOC failed\n"); err = -ENOMEM; === modified file 'hipd/keymat.h' --- hipd/keymat.h 2010-02-17 17:38:08 +0000 +++ hipd/keymat.h 2010-03-19 09:24:10 +0000 @@ -9,7 +9,7 @@ void hip_make_keymat(char *kij, size_t kij_len, struct hip_keymat_keymat *keymat, void *dstbuf, size_t dstbuflen, struct in6_addr *hit1, - struct in6_addr *hit2, u8 *calc_index, uint64_t I, uint64_t J); + struct in6_addr *hit2, uint8_t *calc_index, uint64_t I, uint64_t J); void hip_update_entry_keymat(struct hip_hadb_state *entry, uint16_t new_keymat_index, uint8_t new_calc_index, === modified file 'hipd/netdev.c' --- hipd/netdev.c 2010-03-03 13:16:18 +0000 +++ hipd/netdev.c 2010-03-19 09:24:10 +0000 @@ -1340,7 +1340,7 @@ addr = (struct sockaddr *) &ss_addr; - for (/* VOID */; NLMSG_OK(msg, (u32) len); + for (/* VOID */; NLMSG_OK(msg, (uint32_t) len); msg = NLMSG_NEXT(msg, len)) { int ifindex; ifinfo = (struct ifinfomsg *) NLMSG_DATA(msg); === modified file 'hipd/output.c' --- hipd/output.c 2010-03-03 13:16:18 +0000 +++ hipd/output.c 2010-03-19 09:24:10 +0000 @@ -37,11 +37,11 @@ * Standard BSD internet checksum routine from nmap * for calculating the checksum field of the TCP header */ -unsigned short in_cksum(u16 *ptr, int nbytes) +unsigned short in_cksum(uint16_t *ptr, int nbytes) { - register u32 sum; - u16 oddbyte; - register u16 answer; + register uint32_t sum; + uint16_t oddbyte; + register uint16_t answer; /* * Our algorithm is simple, using a 32-bit accumulator (sum), @@ -216,7 +216,7 @@ } //the checksum if (trafficType == 4) { - pseudo = (struct pseudo_hdr *) (void *) ((u8 *) newTcphdr - sizeof(struct pseudo_hdr)); + pseudo = (struct pseudo_hdr *) (void *) ((uint8_t *) newTcphdr - sizeof(struct pseudo_hdr)); pseudo->s_addr = newIphdr->ip_src.s_addr; pseudo->d_addr = newIphdr->ip_dst.s_addr; @@ -227,7 +227,7 @@ newTcphdr->check = in_cksum((unsigned short *) pseudo, sizeof(struct tcphdr) + 4 * (newTcphdr->doff - 5) + sizeof(struct pseudo_hdr) + 0); } else if (trafficType == 6) { - pseudo6 = (struct pseudo6_hdr *) (void *) ((u8 *) newTcphdr - sizeof(struct pseudo6_hdr)); + pseudo6 = (struct pseudo6_hdr *) (void *) ((uint8_t *) newTcphdr - sizeof(struct pseudo6_hdr)); pseudo6->s_addr = newIp6_hdr->ip6_src; pseudo6->d_addr = newIp6_hdr->ip6_dst; @@ -563,7 +563,7 @@ { hip_common_t *msg = NULL; hip_srv_t service_list[HIP_TOTAL_EXISTING_SERVICES]; - u8 *dh_data1 = NULL, *dh_data2 = NULL; + uint8_t *dh_data1 = NULL, *dh_data2 = NULL; char order[] = "000"; int err = 0, dh_size1 = 0, dh_size2 = 0, written1 = 0, written2 = 0; int mask = 0, i = 0; === modified file 'hipd/pfkeyapi.c' --- hipd/pfkeyapi.c 2010-03-03 13:16:18 +0000 +++ hipd/pfkeyapi.c 2010-03-19 09:24:10 +0000 @@ -316,7 +316,7 @@ const hip_hit_t *dst_hit, u_int prefd, const struct in6_addr *src_addr, const struct in6_addr *dst_addr, - u8 proto, int cmd, int direction) + uint8_t proto, int cmd, int direction) { int err = 0; struct sockaddr_storage ss_addr, dd_addr, ss_hit, dd_hit; @@ -376,12 +376,12 @@ const hip_hit_t *dst_hit, const struct in6_addr *src_addr, const struct in6_addr *dst_addr, - u8 proto, + uint8_t proto, int use_full_prefix, int update) { int so, err = 0; - u8 prefix = (use_full_prefix) ? 128 : HIP_HIT_PREFIX_LEN; + uint8_t prefix = (use_full_prefix) ? 128 : HIP_HIT_PREFIX_LEN; int cmd = update ? SADB_X_SPDUPDATE : SADB_X_SPDADD; HIP_DEBUG("\n"); @@ -409,7 +409,7 @@ const uint8_t proto, const int use_full_prefix) { int so, err = 0; - u8 prefix = (use_full_prefix) ? 128 : HIP_HIT_PREFIX_LEN; + uint8_t prefix = (use_full_prefix) ? 128 : HIP_HIT_PREFIX_LEN; HIP_DEBUG("\n"); HIP_IFEL(((so = pfkey_open()) < 0), -1, "ERROR in opening pfkey socket: %s\n", ipsec_strerror()); === modified file 'hipd/user.c' --- hipd/user.c 2010-02-17 17:38:08 +0000 +++ hipd/user.c 2010-03-19 09:24:10 +0000 @@ -1416,7 +1416,7 @@ { int err = 0; - for (; NLMSG_OK(msg, (u32) len); msg = NLMSG_NEXT(msg, len)) { + for (; NLMSG_OK(msg, (uint32_t) len); msg = NLMSG_NEXT(msg, len)) { switch (msg->nlmsg_type) { case SO_HIP_ADD_PEER_MAP_HIT_IP: HIP_DEBUG("add hit-ip map\n"); === modified file 'lib/core/builder.c' --- lib/core/builder.c 2010-03-03 13:16:18 +0000 +++ lib/core/builder.c 2010-03-19 09:24:10 +0000 @@ -364,7 +364,7 @@ * @param msg the message * @param checksum the checksum value */ -void hip_set_msg_checksum(struct hip_common *msg, u8 checksum) +void hip_set_msg_checksum(struct hip_common *msg, uint8_t checksum) { msg->checksum = checksum; /* one byte, no ntohs() */ } @@ -2017,15 +2017,15 @@ * @return the checksum * @note Checksumming is from Boeing's HIPD. */ -u16 hip_checksum_packet(char *data, struct sockaddr *src, struct sockaddr *dst) +uint16_t hip_checksum_packet(char *data, struct sockaddr *src, struct sockaddr *dst) { - u16 checksum = 0; + uint16_t checksum = 0; unsigned long sum = 0; int count = 0, length = 0; unsigned short *p = NULL; /* 16-bit */ struct pseudo_header pseudoh; struct pseudo_header6 pseudoh6; - u32 src_network, dst_network; + uint32_t src_network, dst_network; struct in6_addr *src6, *dst6; struct hip_common *hiph = (struct hip_common *) data; === modified file 'lib/core/builder.h' --- lib/core/builder.h 2010-02-17 17:38:08 +0000 +++ lib/core/builder.h 2010-03-19 09:24:10 +0000 @@ -191,7 +191,7 @@ struct sockaddr *src, struct sockaddr *dst, int len); -u16 hip_checksum_packet(char *data, struct sockaddr *src, struct sockaddr *dst); +uint16_t hip_checksum_packet(char *data, struct sockaddr *src, struct sockaddr *dst); int hip_check_userspace_msg(const struct hip_common *); int hip_check_userspace_msg_type(const struct hip_common *); void hip_dump_msg(const struct hip_common *); @@ -227,7 +227,7 @@ void hip_msg_init(struct hip_common *); char *hip_param_type_name(const hip_tlv_type_t); void hip_set_msg_err(struct hip_common *, hip_hdr_err_t); -void hip_set_msg_checksum(struct hip_common *msg, u8 checksum); +void hip_set_msg_checksum(struct hip_common *msg, uint8_t checksum); void hip_set_msg_total_len(struct hip_common *, uint16_t); void hip_set_msg_type(struct hip_common *, hip_hdr_type_t); void hip_set_param_contents_len(struct hip_tlv_common *, hip_tlv_len_t); === modified file 'lib/core/crypto.c' --- lib/core/crypto.c 2010-02-17 17:38:08 +0000 +++ lib/core/crypto.c 2010-03-19 09:24:10 +0000 @@ -371,9 +371,9 @@ int err = -1; AES_KEY aes_key; des_key_schedule ks1, ks2, ks3; - u8 secret_key1[8], secret_key2[8], secret_key3[8]; + uint8_t secret_key1[8], secret_key2[8], secret_key3[8]; /* OpenSSL modifies the IV it is passed during the encryption/decryption */ - u8 iv[20]; + uint8_t iv[20]; HIP_IFEL(!(result = malloc(len)), -1, "Out of memory\n"); _HIP_HEXDUMP("hip_crypto_encrypted encrypt data", data, len); @@ -449,7 +449,7 @@ * * @return 0 on success and non-zero on error */ -int impl_dsa_sign(u8 *digest, DSA *dsa, u8 *signature) +int impl_dsa_sign(uint8_t *digest, DSA *dsa, uint8_t *signature) { DSA_SIG *dsa_sig = NULL; int err = 0, t; @@ -497,7 +497,7 @@ * @return 1 for a valid signature, 0 for an incorrect signature and -1 on * error (see ERR_get_error(3) for the actual error) */ -int impl_dsa_verify(u8 *digest, DSA *dsa, u8 *signature) +int impl_dsa_verify(uint8_t *digest, DSA *dsa, uint8_t *signature) { DSA_SIG *dsa_sig; int err = 0; @@ -537,9 +537,9 @@ * @return 1 on success, 0 otherwise */ int hip_gen_dh_shared_key(DH *dh, - u8 *peer_key, + uint8_t *peer_key, size_t peer_len, - u8 *dh_shared_key, + uint8_t *dh_shared_key, size_t outlen) { BIGNUM *peer_pub_key = NULL; @@ -569,7 +569,7 @@ * @param outlen the length of @c out in bytes * @return the number of bytes written */ -int hip_encode_dh_publickey(DH *dh, u8 *out, int outlen) +int hip_encode_dh_publickey(DH *dh, uint8_t *out, int outlen) { int len, err; HIP_IFEL(!dh, -EINVAL, "No Diffie Hellman context for DH tlv.\n"); @@ -629,9 +629,9 @@ * * @return 0 on failure, or the size for storing DH shared secret in bytes */ -u16 hip_get_dh_size(u8 hip_dh_group_type) +uint16_t hip_get_dh_size(uint8_t hip_dh_group_type) { - u16 ret = -1; + uint16_t ret = -1; _HIP_DEBUG("dh_group_type=%u\n", hip_dh_group_type); if (hip_dh_group_type == 0) { === modified file 'lib/core/crypto.h' --- lib/core/crypto.h 2010-02-17 17:38:08 +0000 +++ lib/core/crypto.h 2010-03-19 09:24:10 +0000 @@ -75,17 +75,17 @@ # define HIP_SHA(buffer, total_len, hash) SHA((buffer), (total_len), (hash)); #endif -int ssl_rsa_verify(u8 *digest, u8 *public_key, u8 *signature, int pub_klen); -int ssl_dsa_verify(u8 *digest, u8 *public_key, u8 *signature); +int ssl_rsa_verify(uint8_t *digest, uint8_t *public_key, uint8_t *signature, int pub_klen); +int ssl_dsa_verify(uint8_t *digest, uint8_t *public_key, uint8_t *signature); int hip_init_cipher(void); void hip_uninit_cipher(void); /* In kernel these come from crypto/dh.h, included above */ -int hip_gen_dh_shared_key(DH *dh, u8 *peer_key, size_t peer_len, u8 *out, +int hip_gen_dh_shared_key(DH *dh, uint8_t *peer_key, size_t peer_len, uint8_t *out, size_t outlen); -int hip_encode_dh_publickey(DH *dh, u8 *out, int outlen); +int hip_encode_dh_publickey(DH *dh, uint8_t *out, int outlen); DH *hip_generate_dh_key(int group_id); void hip_free_dh(DH *target); -u16 hip_get_dh_size(u8 hip_dh_group_type); +uint16_t hip_get_dh_size(uint8_t hip_dh_group_type); int dsa_to_hit(DSA *dsa_key, unsigned char *dsa, int type, struct in6_addr *hit); int rsa_to_hit(RSA *rsa_key, unsigned char *rsa, int type, @@ -98,8 +98,8 @@ int load_rsa_private_key(const char *filename, RSA **rsa); int load_dsa_public_key(const char *filenamebase, DSA **dsa); int load_rsa_public_key(const char *filename, RSA **rsa); -int impl_dsa_sign(u8 *digest, DSA *dsa, u8 *signature); -int impl_dsa_verify(u8 *digest, DSA *dsa, u8 *signature); +int impl_dsa_sign(uint8_t *digest, DSA *dsa, uint8_t *signature); +int impl_dsa_verify(uint8_t *digest, DSA *dsa, uint8_t *signature); int hip_write_hmac(int type, const void *key, void *in, int in_len, void *out); int hip_crypto_encrypted(void *data, const void *iv, int enc_alg, int enc_len, void *enc_key, int direction); === modified file 'lib/core/misc.c' --- lib/core/misc.c 2010-03-03 13:16:18 +0000 +++ lib/core/misc.c 2010-03-19 09:24:10 +0000 @@ -54,7 +54,7 @@ int hit_type) { int err = 0; - u8 digest[HIP_AH_SHA_LEN]; + uint8_t digest[HIP_AH_SHA_LEN]; char *key = (char *) (ip); unsigned int key_len = sizeof(struct in6_addr); @@ -488,11 +488,11 @@ } #ifndef __KERNEL__ -u16 ipv4_checksum(u8 protocol, u8 src[], u8 dst[], u8 data[], u16 len) +uint16_t ipv4_checksum(uint8_t protocol, uint8_t src[], uint8_t dst[], uint8_t data[], uint16_t len) { - u16 word16; - u32 sum; - u16 i; + uint16_t word16; + uint32_t sum; + uint16_t i; //initialize sum to zero sum = 0; @@ -500,7 +500,7 @@ // make 16 bit words out of every two adjacent 8 bit words and // calculate the sum of all 16 vit words for (i = 0; i < len; i = i + 2) { - word16 = ((((u16) (data[i] << 8))) & 0xFF00) + (((u16) data[i + 1]) & 0xFF); + word16 = ((((uint16_t) (data[i] << 8))) & 0xFF00) + (((uint16_t) data[i + 1]) & 0xFF); sum = sum + (unsigned long) word16; } // add the TCP pseudo header which contains: @@ -610,14 +610,14 @@ struct in6_addr *hit, int hit_type) { int err = 0; - u8 digest[HIP_AH_SHA_LEN]; - u8 *key_rr = (u8 *) host_id->key; /* skip the header */ + uint8_t digest[HIP_AH_SHA_LEN]; + uint8_t *key_rr = (uint8_t *) host_id->key; /* skip the header */ /* hit excludes rdata but it is included in hi_length; * subtract rdata */ unsigned int key_rr_len = ntohs(host_id->hi_length) - sizeof(struct hip_host_id_key_rdata); - u8 *khi_data = NULL; - u8 khi_context_id[] = HIP_KHI_CONTEXT_ID_INIT; + uint8_t *khi_data = NULL; + uint8_t khi_context_id[] = HIP_KHI_CONTEXT_ID_INIT; int khi_data_len = key_rr_len + sizeof(khi_context_id); int khi_index = 0; @@ -646,7 +646,7 @@ memset(hit, 0, sizeof(hip_hit_t)); HIP_IFEL(khi_encode(digest, sizeof(digest) * 8, - ((u8 *) hit) + 3, + ((uint8_t *) hit) + 3, sizeof(hip_hit_t) * 8 - HIP_HIT_PREFIX_LEN), -1, "encoding failed\n"); @@ -845,8 +845,8 @@ int hip_host_id_contains_private_key(struct hip_host_id *host_id) { uint16_t len = hip_get_param_contents_len(host_id); - u8 *buf = (u8 *) host_id->key; - u8 t = *buf; + uint8_t *buf = (uint8_t *) host_id->key; + uint8_t t = *buf; return len >= 3 * (64 + 8 * t) + 2 * 20; /* PQGXY 3*(64+8*t) + 2*20 */ } @@ -1563,7 +1563,7 @@ } c++; /* If e_len is more than one byte, first byte is 0. */ if (e_len_bytes == 3) { - *c = htons((u16) e_len); + *c = htons((uint16_t) e_len); c += 2; } @@ -1804,7 +1804,7 @@ uint64_t randval = 0; uint64_t maxtries = 0; uint64_t digest = 0; - u8 cookie[48]; + uint8_t cookie[48]; int err = 0; union { struct hip_puzzle pz; @@ -1825,7 +1825,7 @@ " (current max K=%d)\n", u->pz.K, HIP_PUZZLE_MAX_K); mask = hton64((1ULL << u->pz.K) - 1); - memcpy(cookie, (u8 *) &(u->pz.I), sizeof(uint64_t)); + memcpy(cookie, (uint8_t *) &(u->pz.I), sizeof(uint64_t)); HIP_DEBUG("(u->pz.I: 0x%llx\n", u->pz.I); @@ -1851,10 +1851,10 @@ * the next round while (0 > 0) [maxtries > 0 now] */ while (maxtries-- > 0) { - u8 sha_digest[HIP_AH_SHA_LEN]; + uint8_t sha_digest[HIP_AH_SHA_LEN]; /* must be 8 */ - memcpy(cookie + 40, (u8 *) &randval, sizeof(uint64_t)); + memcpy(cookie + 40, (uint8_t *) &randval, sizeof(uint64_t)); hip_build_digest(HIP_DIGEST_SHA1, cookie, 48, sha_digest); @@ -2217,13 +2217,13 @@ int is_priv) { int bytes; - u8 *tmp = (u8 *) host_id->key; + uint8_t *tmp = (uint8_t *) host_id->key; int offset = 0; int e_len = tmp[offset++]; /* Check for public exponent longer than 255 bytes (see RFC 3110) */ if (e_len == 0) { - e_len = ntohs((u16) tmp[offset]); + e_len = ntohs((uint16_t) tmp[offset]); offset += 2; } @@ -2289,7 +2289,7 @@ { int offset = 0; DSA *dsa = NULL; - u8 t = host_id->key[offset++]; + uint8_t t = host_id->key[offset++]; int key_len = 64 + (t * 8); dsa = DSA_new(); === modified file 'lib/core/misc.h' --- lib/core/misc.h 2010-03-03 13:16:18 +0000 +++ lib/core/misc.h 2010-03-19 09:24:10 +0000 @@ -155,7 +155,7 @@ char *hip_in6_ntop(const struct in6_addr *in6, char *buf); char *hip_hit_ntop(const hip_hit_t *hit, char *buf); int hip_host_id_contains_private_key(struct hip_host_id *host_id); -u8 *hip_host_id_extract_public_key(u8 *buffer, struct hip_host_id *data); +uint8_t *hip_host_id_extract_public_key(uint8_t *buffer, struct hip_host_id *data); int hip_lsi_are_equal(const hip_lsi_t *lsi1, const hip_lsi_t *lsi2); @@ -320,7 +320,7 @@ struct in6_addr *src_hit, struct in6_addr *dst_hit); -u16 ipv4_checksum(u8 protocol, u8 src[], u8 dst[], u8 data[], u16 len); +uint16_t ipv4_checksum(uint8_t protocol, uint8_t src[], uint8_t dst[], uint8_t data[], uint16_t len); /* openSSL wrapper functions for base64 encoding and decoding */ === modified file 'lib/core/state.h' --- lib/core/state.h 2010-02-17 17:38:08 +0000 +++ lib/core/state.h 2010-03-19 09:24:10 +0000 @@ -770,7 +770,7 @@ const hip_hit_t *dst_hit, const struct in6_addr *src_addr, const struct in6_addr *dst_addr, - u8 proto, + uint8_t proto, int use_full_prefix, int update); void (*hip_delete_hit_sp_pair)(const hip_hit_t *src_hit, === modified file 'lib/tool/nlink.c' --- lib/tool/nlink.c 2010-03-03 13:16:18 +0000 +++ lib/tool/nlink.c 2010-03-19 09:24:10 +0000 @@ -1443,12 +1443,12 @@ { sel->sport = htons(src_port); if (sel->sport) { - sel->sport_mask = ~((__u16) 0); + sel->sport_mask = ~((__uint16_t) 0); } sel->dport = htons(dst_port); if (sel->dport) { - sel->dport_mask = ~((__u16) 0); + sel->dport_mask = ~((__uint16_t) 0); } return 0; @@ -1492,7 +1492,7 @@ int xfrm_fill_selector(struct xfrm_selector *sel, const struct in6_addr *id_our, const struct in6_addr *id_peer, - uint8_t proto, u8 id_prefix, + uint8_t proto, uint8_t id_prefix, uint32_t src_port, uint32_t dst_port, int preferred_family) { === modified file 'lib/tool/nlink.h' --- lib/tool/nlink.h 2010-03-03 13:16:18 +0000 +++ lib/tool/nlink.h 2010-03-19 09:24:10 +0000 @@ -7,11 +7,11 @@ #include <netinet/in.h> #include <linux/netlink.h> /* CentOS 5.4 and some other legacy systems are broken. Including - linux/rtnetlink.h complains that __u32 or __64 is undefine */ -#ifndef __u32 -#define __u32 uint32_t + linux/rtnetlink.h complains that __uint32_t or __64 is undefine */ +#ifndef __uint32_t +#define __uint32_t uint32_t #define __u64 uint64_t -#endif /* __u32 */ +#endif /* __uint32_t */ #include <linux/xfrm.h> #include <linux/rtnetlink.h> @@ -20,19 +20,19 @@ struct pseudo_hdr { - u32 s_addr; - u32 d_addr; - u8 zer0; - u8 protocol; - u16 length; + uint32_t s_addr; + uint32_t d_addr; + uint8_t zer0; + uint8_t protocol; + uint16_t length; }; struct pseudo6_hdr { struct in6_addr s_addr; struct in6_addr d_addr; - u8 zer0; - u8 protocol; - u16 length; + uint8_t zer0; + uint8_t protocol; + uint16_t length; }; #define HIP_OPTION_KIND 30 @@ -105,7 +105,7 @@ int xfrm_fill_selector(struct xfrm_selector *sel, const struct in6_addr *id_our, const struct in6_addr *id_peer, - uint8_t proto, u8 id_prefix, + uint8_t proto, uint8_t id_prefix, uint32_t src_port, uint32_t dst_port, int preferred_family); int xfrm_fill_encap(struct xfrm_encap_tmpl *encap, === modified file 'lib/tool/pk.c' --- lib/tool/pk.c 2010-02-17 17:38:08 +0000 +++ lib/tool/pk.c 2010-03-19 09:24:10 +0000 @@ -36,8 +36,8 @@ int hip_rsa_sign(void *priv_key, struct hip_common *msg) { RSA *rsa = (RSA *) priv_key; - u8 sha1_digest[HIP_AH_SHA_LEN]; - u8 *signature = NULL; + uint8_t sha1_digest[HIP_AH_SHA_LEN]; + uint8_t *signature = NULL; int err = 0, len; unsigned int sig_len; @@ -84,8 +84,8 @@ int hip_dsa_sign(void *priv_key, struct hip_common *msg) { DSA *dsa = (DSA *) priv_key; - u8 sha1_digest[HIP_AH_SHA_LEN]; - u8 signature[HIP_DSA_SIGNATURE_LEN]; + uint8_t sha1_digest[HIP_AH_SHA_LEN]; + uint8_t signature[HIP_DSA_SIGNATURE_LEN]; int err = 0, len; len = hip_get_msg_total_len(msg); @@ -123,7 +123,7 @@ { int err = 0, len, origlen; struct hip_sig *sig; - u8 sha1_digest[HIP_AH_SHA_LEN]; + uint8_t sha1_digest[HIP_AH_SHA_LEN]; struct in6_addr tmpaddr; struct hip_puzzle *pz = NULL; uint8_t opaque[3]; @@ -152,7 +152,7 @@ } //HIP_HEXDUMP("SIG", sig, hip_get_param_total_len(sig)); - len = ((u8 *) sig) - ((u8 *) msg); + len = ((uint8_t *) sig) - ((uint8_t *) msg); hip_zero_msg_checksum(msg); HIP_IFEL(len < 0, -ENOENT, "Invalid signature len\n"); hip_set_msg_total_len(msg, len); === modified file 'lib/tool/xfrmapi.c' --- lib/tool/xfrmapi.c 2010-03-03 13:16:18 +0000 +++ lib/tool/xfrmapi.c 2010-03-19 09:24:10 +0000 @@ -80,7 +80,7 @@ const struct in6_addr *id_peer, const struct in6_addr *tmpl_saddr, const struct in6_addr *tmpl_daddr, - int dir, u8 proto, u8 id_prefix, + int dir, uint8_t proto, uint8_t id_prefix, int preferred_family) { struct { @@ -455,7 +455,7 @@ static int hip_calc_sp_prefix(const struct in6_addr *src_id, int use_full_prefix) { - u8 prefix; + uint8_t prefix; if (IN6_IS_ADDR_V4MAPPED(src_id)) { HIP_DEBUG("ipv4 address mapped as ipv6\n"); @@ -695,14 +695,14 @@ const struct in6_addr *dst_id, const struct in6_addr *src_addr, const struct in6_addr *dst_addr, - u8 proto, + uint8_t proto, int use_full_prefix, int update) { HIP_DEBUG("Start\n"); int err = 0; - u8 prefix = hip_calc_sp_prefix(src_id, use_full_prefix); + uint8_t prefix = hip_calc_sp_prefix(src_id, use_full_prefix); int cmd = update ? XFRM_MSG_UPDPOLICY : XFRM_MSG_NEWPOLICY; /* XX FIXME: remove the proto argument */ @@ -737,7 +737,7 @@ const uint8_t proto, const int use_full_prefix) { - u8 prefix = (use_full_prefix) ? 128 : HIP_HIT_PREFIX_LEN; + uint8_t prefix = (use_full_prefix) ? 128 : HIP_HIT_PREFIX_LEN; hip_xfrm_policy_delete(hip_xfrmapi_nl_ipsec, dst_hit, src_hit, XFRM_POLICY_IN, proto, prefix, AF_INET6); === modified file 'lib/tool/xfrmapi.h' --- lib/tool/xfrmapi.h 2010-03-03 13:16:18 +0000 +++ lib/tool/xfrmapi.h 2010-03-19 09:24:10 +0000 @@ -63,7 +63,7 @@ const hip_hit_t *dst_hit, const struct in6_addr *src_addr, const struct in6_addr *dst_addr, - u8 proto, + uint8_t proto, int use_full_prefix, int update); === modified file 'test/dh_performance.c' --- test/dh_performance.c 2010-02-17 17:38:08 +0000 +++ test/dh_performance.c 2010-03-19 09:24:10 +0000 @@ -410,7 +410,7 @@ printf( "-------------------------------\n" "RSA performance test\n" "-------------------------------\n\n"); - //impl_dsa_sign(u8 *digest, u8 *private_key, u8 *signature) + //impl_dsa_sign(uint8_t *digest, uint8_t *private_key, uint8_t *signature) rsa_key_pool = malloc(sw_create_rsa * sizeof(RSA *)); @@ -459,10 +459,10 @@ /* if sw_rsa_sig_len == 0 we will use the default lengths as they * occur in hip */ - u8 rsa_data[SHA_DIGEST_LENGTH]; + uint8_t rsa_data[SHA_DIGEST_LENGTH]; memset(rsa_data, 22, SHA_DIGEST_LENGTH); - u8 **rsa_sig_pool; - rsa_sig_pool = malloc(sw_bench_loops * sizeof(u8 *)); + uint8_t **rsa_sig_pool; + rsa_sig_pool = malloc(sw_bench_loops * sizeof(uint8_t *)); printf("Calculating %d RSA signatures (len: %d)\n", sw_bench_loops, sw_rsa_keylen); @@ -536,7 +536,7 @@ printf( "-------------------------------\n" "DSA performance test\n" "-------------------------------\n\n"); - //impl_dsa_sign(u8 *digest, u8 *private_key, u8 *signature) + //impl_dsa_sign(uint8_t *digest, uint8_t *private_key, uint8_t *signature) dsa_key_pool = malloc(sw_create_dsa * sizeof(DSA *)); printf("Creating key pool of %d keys of length %d.\n", @@ -586,7 +586,7 @@ /* if sw_dsa_sig_len == 0 we will use the default lengths as they * occur in hip */ - u8 dsa_data[SHA_DIGEST_LENGTH]; + uint8_t dsa_data[SHA_DIGEST_LENGTH]; memset(dsa_data, 22, SHA_DIGEST_LENGTH); DSA_SIG **dsa_sig_pool; dsa_sig_pool = malloc(sw_bench_loops * sizeof(DSA_SIG *)); @@ -702,7 +702,7 @@ dhp_start_benchmark(&bench_time); int dh_size = hip_get_dh_size(HIP_FIRST_DH_GROUP_ID); - u8 shared_key[sw_shared_key_len]; + uint8_t shared_key[sw_shared_key_len]; uint8_t pub_key[dh_size]; @@ -778,8 +778,8 @@ "-------------------------------\n\n"); printf("Creating %d hashes\n", sw_hashloops); - u8 buffer1[HASH_LEN]; - u8 buffer2[HASH_LEN]; + uint8_t buffer1[HASH_LEN]; + uint8_t buffer2[HASH_LEN]; memset(buffer1, 22, SHA_DIGEST_LENGTH); memset(buffer2, 25, SHA_DIGEST_LENGTH);