Use standard unsigned integer types

laforge/swu
Andreas Steffen 7 years ago
parent b210369314
commit b12c53ce77
  1. 10
      scripts/timeattack.c
  2. 2
      src/charon-cmd/cmd/cmd_connection.c
  3. 4
      src/charon-nm/nm/nm_service.c
  4. 6
      src/charon-tkm/src/tkm/tkm_diffie_hellman.c
  5. 28
      src/charon-tkm/src/tkm/tkm_kernel_ipsec.c
  6. 32
      src/charon-tkm/src/tkm/tkm_kernel_sad.c
  7. 10
      src/charon-tkm/src/tkm/tkm_kernel_sad.h
  8. 8
      src/charon-tkm/src/tkm/tkm_keymat.c
  9. 2
      src/charon-tkm/src/tkm/tkm_nonceg.c
  10. 12
      src/charon-tkm/src/tkm/tkm_spi_generator.c
  11. 6
      src/charon-tkm/tests/nonceg_tests.c
  12. 2
      src/checksum/checksum_builder.c
  13. 2
      src/conftest/actions.c
  14. 2
      src/conftest/config.c
  15. 4
      src/conftest/hooks/custom_proposal.c
  16. 2
      src/conftest/hooks/log_proposals.c
  17. 2
      src/conftest/hooks/rebuild_auth.c
  18. 2
      src/conftest/hooks/reset_seq.c
  19. 4
      src/conftest/hooks/set_ike_spi.c
  20. 4
      src/conftest/hooks/set_length.c
  21. 2
      src/conftest/hooks/set_proposal_number.c
  22. 6
      src/conftest/hooks/set_reserved.c
  23. 18
      src/dumm/mconsole.c
  24. 16
      src/frontends/android/app/src/main/jni/libandroidbridge/backend/android_dns_proxy.c
  25. 16
      src/frontends/android/app/src/main/jni/libandroidbridge/backend/android_service.c
  26. 4
      src/frontends/android/app/src/main/jni/libandroidbridge/byod/imc_android.c
  27. 6
      src/frontends/android/app/src/main/jni/libandroidbridge/byod/imc_android_state.c
  28. 26
      src/frontends/android/app/src/main/jni/libandroidbridge/kernel/android_ipsec.c
  29. 4
      src/frontends/android/app/src/main/jni/libandroidbridge/kernel/android_net.c
  30. 14
      src/frontends/osx/charon-xpc/xpc_channels.c
  31. 2
      src/frontends/osx/charon-xpc/xpc_channels.h
  32. 6
      src/frontends/osx/charon-xpc/xpc_dispatch.c
  33. 4
      src/frontends/osx/charon-xpc/xpc_logger.c
  34. 2
      src/frontends/osx/charon-xpc/xpc_logger.h
  35. 2
      src/include/linux/pfkeyv2.h
  36. 16
      src/libcharon/attributes/mem_pool.c
  37. 2
      src/libcharon/bus/bus.c
  38. 2
      src/libcharon/bus/bus.h
  39. 2
      src/libcharon/bus/listeners/listener.h
  40. 26
      src/libcharon/config/child_cfg.c
  41. 14
      src/libcharon/config/child_cfg.h
  42. 24
      src/libcharon/config/ike_cfg.c
  43. 12
      src/libcharon/config/ike_cfg.h
  44. 34
      src/libcharon/config/peer_cfg.c
  45. 20
      src/libcharon/config/peer_cfg.h
  46. 28
      src/libcharon/config/proposal.c
  47. 10
      src/libcharon/config/proposal.h
  48. 10
      src/libcharon/control/controller.c
  49. 4
      src/libcharon/control/controller.h
  50. 64
      src/libcharon/encoding/generator.c
  51. 2
      src/libcharon/encoding/generator.h
  52. 42
      src/libcharon/encoding/message.c
  53. 16
      src/libcharon/encoding/message.h
  54. 64
      src/libcharon/encoding/parser.c
  55. 2
      src/libcharon/encoding/parser.h
  56. 8
      src/libcharon/encoding/payloads/auth_payload.c
  57. 6
      src/libcharon/encoding/payloads/cert_payload.c
  58. 6
      src/libcharon/encoding/payloads/certreq_payload.c
  59. 12
      src/libcharon/encoding/payloads/configuration_attribute.c
  60. 4
      src/libcharon/encoding/payloads/configuration_attribute.h
  61. 14
      src/libcharon/encoding/payloads/cp_payload.c
  62. 4
      src/libcharon/encoding/payloads/cp_payload.h
  63. 28
      src/libcharon/encoding/payloads/delete_payload.c
  64. 8
      src/libcharon/encoding/payloads/delete_payload.h
  65. 28
      src/libcharon/encoding/payloads/eap_payload.c
  66. 12
      src/libcharon/encoding/payloads/eap_payload.h
  67. 6
      src/libcharon/encoding/payloads/encodings.h
  68. 6
      src/libcharon/encoding/payloads/encrypted_fragment_payload.h
  69. 48
      src/libcharon/encoding/payloads/encrypted_payload.c
  70. 2
      src/libcharon/encoding/payloads/encrypted_payload.h
  71. 44
      src/libcharon/encoding/payloads/endpoint_notify.c
  72. 4
      src/libcharon/encoding/payloads/endpoint_notify.h
  73. 18
      src/libcharon/encoding/payloads/fragment_payload.c
  74. 6
      src/libcharon/encoding/payloads/fragment_payload.h
  75. 6
      src/libcharon/encoding/payloads/hash_payload.c
  76. 18
      src/libcharon/encoding/payloads/id_payload.c
  77. 40
      src/libcharon/encoding/payloads/ike_header.c
  78. 24
      src/libcharon/encoding/payloads/ike_header.h
  79. 8
      src/libcharon/encoding/payloads/ke_payload.c
  80. 4
      src/libcharon/encoding/payloads/nonce_payload.c
  81. 24
      src/libcharon/encoding/payloads/notify_payload.c
  82. 8
      src/libcharon/encoding/payloads/notify_payload.h
  83. 2
      src/libcharon/encoding/payloads/payload.c
  84. 2
      src/libcharon/encoding/payloads/payload.h
  85. 100
      src/libcharon/encoding/payloads/proposal_substructure.c
  86. 22
      src/libcharon/encoding/payloads/proposal_substructure.h
  87. 32
      src/libcharon/encoding/payloads/sa_payload.c
  88. 14
      src/libcharon/encoding/payloads/sa_payload.h
  89. 10
      src/libcharon/encoding/payloads/traffic_selector_substructure.c
  90. 4
      src/libcharon/encoding/payloads/traffic_selector_substructure.h
  91. 14
      src/libcharon/encoding/payloads/transform_attribute.c
  92. 6
      src/libcharon/encoding/payloads/transform_attribute.h
  93. 18
      src/libcharon/encoding/payloads/transform_substructure.c
  94. 6
      src/libcharon/encoding/payloads/transform_substructure.h
  95. 6
      src/libcharon/encoding/payloads/ts_payload.c
  96. 4
      src/libcharon/encoding/payloads/unknown_payload.c
  97. 4
      src/libcharon/encoding/payloads/vendor_id_payload.c
  98. 10
      src/libcharon/kernel/kernel_handler.c
  99. 58
      src/libcharon/kernel/kernel_interface.c
  100. 52
      src/libcharon/kernel/kernel_interface.h
  101. Some files were not shown because too many files have changed in this diff Show More

@ -10,7 +10,7 @@ static void start_timing(struct timespec *start)
clock_gettime(CLOCK_PROCESS_CPUTIME_ID, start);
}
static u_int64_t end_timing(struct timespec *start)
static uint64_t end_timing(struct timespec *start)
{
struct timespec end;
@ -21,12 +21,12 @@ static u_int64_t end_timing(struct timespec *start)
static int intcmp(const void *a, const void *b)
{
return *(u_int64_t*)a - *(u_int64_t*)b;
return *(uint64_t*)a - *(uint64_t*)b;
}
static u_int64_t median(u_int64_t *m, int count)
static uint64_t median(uint64_t *m, int count)
{
qsort(m, count, sizeof(u_int64_t), intcmp);
qsort(m, count, sizeof(uint64_t), intcmp);
return m[count / 2];
}
@ -35,7 +35,7 @@ static bool timeattack(attackfn_t attackfn, void *subj, size_t dlen,
{
struct timespec start;
u_char test[dlen];
u_int64_t mini, maxi, t[256], m[256][10];
uint64_t mini, maxi, t[256], m[256][10];
float fastdist = 0, slowdist = 0;
int i, j, k, l, byte, limit, retry = 0;
int fastest = 0, slowest = 0;

@ -142,7 +142,7 @@ static peer_cfg_t* create_peer_cfg(private_cmd_connection_t *this)
{
ike_cfg_t *ike_cfg;
peer_cfg_t *peer_cfg;
u_int16_t local_port, remote_port = IKEV2_UDP_PORT;
uint16_t local_port, remote_port = IKEV2_UDP_PORT;
ike_version_t version = IKE_ANY;
bool aggressive = FALSE;
proposal_t *proposal;

@ -68,7 +68,7 @@ static GValue* handler_to_val(nm_handler_t *handler,
array = g_array_new (FALSE, TRUE, sizeof (guint32));
while (enumerator->enumerate(enumerator, &chunk))
{
g_array_append_val (array, *(u_int32_t*)chunk.ptr);
g_array_append_val (array, *(uint32_t*)chunk.ptr);
}
enumerator->destroy(enumerator);
val = g_slice_new0 (GValue);
@ -113,7 +113,7 @@ static void signal_ipv4_config(NMVPNPlugin *plugin,
enumerator->destroy(enumerator);
val = g_slice_new0(GValue);
g_value_init(val, G_TYPE_UINT);
g_value_set_uint(val, *(u_int32_t*)me->get_address(me).ptr);
g_value_set_uint(val, *(uint32_t*)me->get_address(me).ptr);
g_hash_table_insert(config, NM_VPN_PLUGIN_IP4_CONFIG_ADDRESS, val);
val = g_slice_new0(GValue);

@ -123,7 +123,7 @@ int register_dh_mapping()
int count, i;
char *iana_id_str, *tkm_id_str;
diffie_hellman_group_t *iana_id;
u_int64_t *tkm_id;
uint64_t *tkm_id;
hashtable_t *map;
enumerator_t *enumerator;
@ -138,7 +138,7 @@ int register_dh_mapping()
{
iana_id = malloc_thing(diffie_hellman_group_t);
*iana_id = settings_value_as_int(iana_id_str, 0);
tkm_id = malloc_thing(u_int64_t);
tkm_id = malloc_thing(uint64_t);
*tkm_id = settings_value_as_int(tkm_id_str, 0);
map->put(map, iana_id, tkm_id);
@ -227,7 +227,7 @@ tkm_diffie_hellman_t *tkm_diffie_hellman_create(diffie_hellman_group_t group)
return NULL;
}
u_int64_t *dha_id = group_map->get(group_map, &group);
uint64_t *dha_id = group_map->get(group_map, &group);
if (!dha_id)
{
free(this);

@ -54,7 +54,7 @@ struct private_tkm_kernel_ipsec_t {
METHOD(kernel_ipsec_t, get_spi, status_t,
private_tkm_kernel_ipsec_t *this, host_t *src, host_t *dst,
u_int8_t protocol, u_int32_t *spi)
uint8_t protocol, uint32_t *spi)
{
bool result;
@ -68,24 +68,24 @@ METHOD(kernel_ipsec_t, get_spi, status_t,
}
}
result = this->rng->get_bytes(this->rng, sizeof(u_int32_t),
(u_int8_t *)spi);
result = this->rng->get_bytes(this->rng, sizeof(uint32_t),
(uint8_t *)spi);
return result ? SUCCESS : FAILED;
}
METHOD(kernel_ipsec_t, get_cpi, status_t,
private_tkm_kernel_ipsec_t *this, host_t *src, host_t *dst,
u_int16_t *cpi)
uint16_t *cpi)
{
return NOT_SUPPORTED;
}
METHOD(kernel_ipsec_t, add_sa, status_t,
private_tkm_kernel_ipsec_t *this, host_t *src, host_t *dst,
u_int32_t spi, u_int8_t protocol, u_int32_t reqid, mark_t mark,
u_int32_t tfc, lifetime_cfg_t *lifetime, u_int16_t enc_alg, chunk_t enc_key,
u_int16_t int_alg, chunk_t int_key, ipsec_mode_t mode,
u_int16_t ipcomp, u_int16_t cpi, u_int32_t replay_window,
uint32_t spi, uint8_t protocol, uint32_t reqid, mark_t mark,
uint32_t tfc, lifetime_cfg_t *lifetime, uint16_t enc_alg, chunk_t enc_key,
uint16_t int_alg, chunk_t int_key, ipsec_mode_t mode,
uint16_t ipcomp, uint16_t cpi, uint32_t replay_window,
bool initiator, bool encap, bool esn, bool inbound, bool update,
linked_list_t* src_ts, linked_list_t* dst_ts)
{
@ -209,15 +209,15 @@ sad_failure:
METHOD(kernel_ipsec_t, query_sa, status_t,
private_tkm_kernel_ipsec_t *this, host_t *src, host_t *dst,
u_int32_t spi, u_int8_t protocol, mark_t mark, u_int64_t *bytes,
u_int64_t *packets, time_t *time)
uint32_t spi, uint8_t protocol, mark_t mark, uint64_t *bytes,
uint64_t *packets, time_t *time)
{
return NOT_SUPPORTED;
}
METHOD(kernel_ipsec_t, del_sa, status_t,
private_tkm_kernel_ipsec_t *this, host_t *src, host_t *dst,
u_int32_t spi, u_int8_t protocol, u_int16_t cpi, mark_t mark)
uint32_t spi, uint8_t protocol, uint16_t cpi, mark_t mark)
{
esa_id_type esa_id, other_esa_id;
@ -249,8 +249,8 @@ METHOD(kernel_ipsec_t, del_sa, status_t,
}
METHOD(kernel_ipsec_t, update_sa, status_t,
private_tkm_kernel_ipsec_t *this, u_int32_t spi, u_int8_t protocol,
u_int16_t cpi, host_t *src, host_t *dst, host_t *new_src, host_t *new_dst,
private_tkm_kernel_ipsec_t *this, uint32_t spi, uint8_t protocol,
uint16_t cpi, host_t *src, host_t *dst, host_t *new_src, host_t *new_dst,
bool old_encap, bool new_encap, mark_t mark)
{
return NOT_SUPPORTED;
@ -338,7 +338,7 @@ METHOD(kernel_ipsec_t, bypass_socket, bool,
}
METHOD(kernel_ipsec_t, enable_udp_decap, bool,
private_tkm_kernel_ipsec_t *this, int fd, int family, u_int16_t port)
private_tkm_kernel_ipsec_t *this, int fd, int family, uint16_t port)
{
int type = UDP_ENCAP_ESPINUDP;

@ -59,7 +59,7 @@ struct sad_entry_t {
/**
* Reqid.
*/
u_int32_t reqid;
uint32_t reqid;
/**
* Source address of CHILD SA.
@ -74,17 +74,17 @@ struct sad_entry_t {
/**
* Local SPI of CHILD SA.
*/
u_int32_t spi_loc;
uint32_t spi_loc;
/**
* Remote SPI of CHILD SA.
*/
u_int32_t spi_rem;
uint32_t spi_rem;
/**
* Protocol of CHILD SA (ESP/AH).
*/
u_int8_t proto;
uint8_t proto;
};
@ -105,8 +105,8 @@ static void sad_entry_destroy(sad_entry_t *entry)
* Find a list entry with given src, dst, (remote) spi and proto values.
*/
static bool sad_entry_match(sad_entry_t * const entry, const host_t * const src,
const host_t * const dst, const u_int32_t * const spi,
const u_int8_t * const proto)
const host_t * const dst, const uint32_t * const spi,
const uint8_t * const proto)
{
if (entry->src == NULL || entry->dst == NULL)
{
@ -122,9 +122,9 @@ static bool sad_entry_match(sad_entry_t * const entry, const host_t * const src,
* Find a list entry with given reqid, spi and proto values.
*/
static bool sad_entry_match_dst(sad_entry_t * const entry,
const u_int32_t * const reqid,
const u_int32_t * const spi,
const u_int8_t * const proto)
const uint32_t * const reqid,
const uint32_t * const spi,
const uint8_t * const proto)
{
return entry->reqid == *reqid &&
entry->spi_rem == *spi &&
@ -145,7 +145,7 @@ static bool sad_entry_match_esa_id(sad_entry_t * const entry,
*/
static bool sad_entry_match_other_esa(sad_entry_t * const entry,
const esa_id_type * const esa_id,
const u_int32_t * const reqid)
const uint32_t * const reqid)
{
return entry->reqid == *reqid &&
entry->esa_id != *esa_id;
@ -172,8 +172,8 @@ static bool sad_entry_equal(sad_entry_t * const left, sad_entry_t * const right)
METHOD(tkm_kernel_sad_t, insert, bool,
private_tkm_kernel_sad_t * const this, const esa_id_type esa_id,
const u_int32_t reqid, const host_t * const src, const host_t * const dst,
const u_int32_t spi_loc, const u_int32_t spi_rem, const u_int8_t proto)
const uint32_t reqid, const host_t * const src, const host_t * const dst,
const uint32_t spi_loc, const uint32_t spi_rem, const uint8_t proto)
{
status_t result;
sad_entry_t *new_entry;
@ -212,7 +212,7 @@ METHOD(tkm_kernel_sad_t, insert, bool,
METHOD(tkm_kernel_sad_t, get_esa_id, esa_id_type,
private_tkm_kernel_sad_t * const this, const host_t * const src,
const host_t * const dst, const u_int32_t spi, const u_int8_t proto)
const host_t * const dst, const uint32_t spi, const uint8_t proto)
{
esa_id_type id = 0;
sad_entry_t *entry = NULL;
@ -242,7 +242,7 @@ METHOD(tkm_kernel_sad_t, get_other_esa_id, esa_id_type,
{
esa_id_type id = 0;
sad_entry_t *entry = NULL;
u_int32_t reqid;
uint32_t reqid;
status_t res;
this->mutex->lock(this->mutex);
@ -274,8 +274,8 @@ METHOD(tkm_kernel_sad_t, get_other_esa_id, esa_id_type,
}
METHOD(tkm_kernel_sad_t, get_dst_host, host_t *,
private_tkm_kernel_sad_t * const this, const u_int32_t reqid,
const u_int32_t spi, const u_int8_t proto)
private_tkm_kernel_sad_t * const this, const uint32_t reqid,
const uint32_t spi, const uint8_t proto)
{
host_t *dst = NULL;
sad_entry_t *entry = NULL;

@ -46,9 +46,9 @@ struct tkm_kernel_sad_t {
* @return TRUE if entry was inserted, FALSE otherwise
*/
bool (*insert)(tkm_kernel_sad_t * const this, const esa_id_type esa_id,
const u_int32_t reqid, const host_t * const src,
const host_t * const dst, const u_int32_t spi_loc,
const u_int32_t spi_rem, const u_int8_t proto);
const uint32_t reqid, const host_t * const src,
const host_t * const dst, const uint32_t spi_loc,
const uint32_t spi_rem, const uint8_t proto);
/**
* Get ESA id for entry with given parameters.
@ -61,7 +61,7 @@ struct tkm_kernel_sad_t {
*/
esa_id_type (*get_esa_id)(tkm_kernel_sad_t * const this,
const host_t * const src, const host_t * const dst,
const u_int32_t spi, const u_int8_t proto);
const uint32_t spi, const uint8_t proto);
/**
* Get ESA id for entry associated with same security policy as the
@ -82,7 +82,7 @@ struct tkm_kernel_sad_t {
* @return destination host of entry if found, NULL otherwise
*/
host_t * (*get_dst_host)(tkm_kernel_sad_t * const this,
const u_int32_t reqid, const u_int32_t spi, const u_int8_t proto);
const uint32_t reqid, const uint32_t spi, const uint8_t proto);
/**
* Remove entry with given ESA id from SAD.

@ -96,8 +96,8 @@ struct private_tkm_keymat_t {
static void aead_create_from_keys(aead_t **in, aead_t **out,
const chunk_t * const sk_ai, const chunk_t * const sk_ar,
const chunk_t * const sk_ei, const chunk_t * const sk_er,
const u_int16_t enc_alg, const u_int16_t int_alg,
const u_int16_t key_size, bool initiator)
const uint16_t enc_alg, const uint16_t int_alg,
const uint16_t key_size, bool initiator)
{
*in = *out = NULL;
signer_t *signer_i, *signer_r;
@ -187,8 +187,8 @@ METHOD(keymat_v2_t, derive_ike_keys, bool,
chunk_t nonce_i, chunk_t nonce_r, ike_sa_id_t *id,
pseudo_random_function_t rekey_function, chunk_t rekey_skd)
{
u_int16_t enc_alg, int_alg, key_size;
u_int64_t nc_id, spi_loc, spi_rem;
uint16_t enc_alg, int_alg, key_size;
uint64_t nc_id, spi_loc, spi_rem;
chunk_t *nonce, c_ai, c_ar, c_ei, c_er;
tkm_diffie_hellman_t *tkm_dh;
dh_id_type dh_id;

@ -39,7 +39,7 @@ struct private_tkm_nonceg_t {
};
METHOD(nonce_gen_t, get_nonce, bool,
private_tkm_nonceg_t *this, size_t size, u_int8_t *buffer)
private_tkm_nonceg_t *this, size_t size, uint8_t *buffer)
{
nonce_type nonce;
uint64_t nc_id;

@ -25,8 +25,8 @@
*/
typedef struct {
rng_t *rng;
u_int64_t spi_mask;
u_int64_t spi_label;
uint64_t spi_mask;
uint64_t spi_label;
} get_spi_args_t;
static get_spi_args_t *spi_args;
@ -37,12 +37,12 @@ static get_spi_args_t *spi_args;
* @param this Callback args containing rng_t and spi mask & label
* @return labeled SPI
*/
CALLBACK(tkm_get_spi, u_int64_t,
CALLBACK(tkm_get_spi, uint64_t,
const get_spi_args_t const *this)
{
u_int64_t spi;
uint64_t spi;
if (!this->rng->get_bytes(this->rng, sizeof(spi), (u_int8_t*)&spi))
if (!this->rng->get_bytes(this->rng, sizeof(spi), (uint8_t*)&spi))
{
return 0;
}
@ -54,7 +54,7 @@ bool tkm_spi_generator_register(plugin_t *plugin,
plugin_feature_t *feature,
bool reg, void *cb_data)
{
u_int64_t spi_mask, spi_label;
uint64_t spi_mask, spi_label;
char *spi_val;
rng_t *rng;

@ -37,7 +37,7 @@ START_TEST(test_nonceg_allocate_nonce)
tkm_nonceg_t *ng = tkm_nonceg_create();
const size_t length = 256;
u_int8_t zero[length];
uint8_t zero[length];
memset(zero, 0, length);
chunk_t nonce;
@ -61,10 +61,10 @@ START_TEST(test_nonceg_get_nonce)
tkm_nonceg_t *ng = tkm_nonceg_create();
const size_t length = 128;
u_int8_t zero[length];
uint8_t zero[length];
memset(zero, 0, length);
u_int8_t *buf = malloc(length + 1);
uint8_t *buf = malloc(length + 1);
memset(buf, 0, length);
/* set end marker */
buf[length] = 255;

@ -33,7 +33,7 @@ integrity_checker_t *integrity;
static void build_checksum(char *path, char *name, char *sname)
{
void *handle, *symbol;
u_int32_t fsum, ssum;
uint32_t fsum, ssum;
size_t fsize = 0;
size_t ssize = 0;

@ -117,7 +117,7 @@ static job_requeue_t rekey_child(char *config)
enumerator_t *enumerator, *children;
ike_sa_t *ike_sa;
child_sa_t *child_sa;
u_int32_t spi, proto;
uint32_t spi, proto;
host_t *dst = NULL;
enumerator = charon->controller->create_ike_sa_enumerator(

@ -146,7 +146,7 @@ static child_cfg_t *load_child_config(private_config_t *this,
traffic_selector_t *ts;
ipsec_mode_t mode = MODE_TUNNEL;
char *token;
u_int32_t tfc;
uint32_t tfc;
if (settings->get_bool(settings, "configs.%s.%s.transport",
FALSE, config, child))

@ -52,7 +52,7 @@ struct private_custom_proposal_t {
* Load custom proposal configuration to proposal list
*/
static linked_list_t* load_proposals(private_custom_proposal_t *this,
protocol_id_t proto, u_int64_t spi)
protocol_id_t proto, uint64_t spi)
{
enumerator_t *props, *algs;
char *number, *key, *value;
@ -65,7 +65,7 @@ static linked_list_t* load_proposals(private_custom_proposal_t *this,
{
const proposal_token_t *token = NULL;
proposal_t *proposal;
u_int16_t type, alg, keysize = 0;
uint16_t type, alg, keysize = 0;
char *end;
proposal = proposal_create(proto, atoi(number));

@ -54,7 +54,7 @@ METHOD(listener_t, message, bool,
proposals = list->create_enumerator(list);
while (proposals->enumerate(proposals, &proposal))
{
u_int64_t spi = proposal->get_spi(proposal);
uint64_t spi = proposal->get_spi(proposal);
if (proposal->get_protocol(proposal) != PROTO_IKE)
{

@ -67,7 +67,7 @@ static bool rebuild_auth(private_rebuild_auth_t *this, ike_sa_t *ike_sa,
char reserved[3];
generator_t *generator;
chunk_t data;
u_int32_t *lenpos;
uint32_t *lenpos;
payload = message->get_payload(message,
message->get_request(message) ? PLV2_ID_INITIATOR : PLV2_ID_RESPONDER);

@ -154,7 +154,7 @@ static job_requeue_t reset_cb(struct reset_cb_data_t *data)
* Schedule sequence number reset job
*/
static void schedule_reset_job(private_reset_seq_t *this, host_t *dst,
u_int32_t spi)
uint32_t spi)
{
struct reset_cb_data_t *data;
chunk_t chunk;

@ -42,12 +42,12 @@ struct private_set_ike_spi_t {
/**
* Initiator SPI
*/
u_int64_t spii;
uint64_t spii;
/**
* Responder SPI
*/
u_int64_t spir;
uint64_t spir;
};
METHOD(listener_t, message, bool,

@ -75,7 +75,7 @@ METHOD(listener_t, message, bool,
if (type == payload->get_type(payload))
{
encoding_rule_t *rules;
u_int16_t *len;
uint16_t *len;
int i, count;
count = payload->get_encoding_rules(payload, &rules);
@ -83,7 +83,7 @@ METHOD(listener_t, message, bool,
{
if (rules[i].type == PAYLOAD_LENGTH)
{
len = (u_int16_t*)(((void*)payload) + rules[i].offset);
len = (uint16_t*)(((void*)payload) + rules[i].offset);
DBG1(DBG_CFG, "adjusting length of %N payload "
"from %d to %d", payload_type_short_names, type,
*len, *len + this->diff);

@ -57,7 +57,7 @@ static void copy_proposal_algs(proposal_t *from, proposal_t *to,
transform_type_t type)
{
enumerator_t *enumerator;
u_int16_t alg, key_size;
uint16_t alg, key_size;
enumerator = from->create_enumerator(from, type);
while (enumerator->enumerate(enumerator, &alg, &key_size))

@ -85,11 +85,11 @@ static void set_bit(private_set_reserved_t *this, message_t *message,
* Set reserved byte of a payload
*/
static void set_byte(private_set_reserved_t *this, message_t *message,
payload_type_t type, u_int nr, u_int8_t byteval)
payload_type_t type, u_int nr, uint8_t byteval)
{
enumerator_t *payloads;
payload_t *payload;
u_int8_t *byte;
uint8_t *byte;
if (type == PLV2_TRANSFORM_SUBSTRUCTURE || type == PLV2_PROPOSAL_SUBSTRUCTURE)
{
@ -172,7 +172,7 @@ METHOD(listener_t, message, bool,
enumerator_t *bits, *bytes, *types;
payload_type_t type;
char *nr, *name;
u_int8_t byteval;
uint8_t byteval;
types = conftest->test->create_section_enumerator(conftest->test,
"hooks.%s", this->name);

@ -54,9 +54,9 @@ struct private_mconsole_t {
typedef struct mconsole_request mconsole_request;
/** mconsole request message */
struct mconsole_request {
u_int32_t magic;
u_int32_t version;
u_int32_t len;
uint32_t magic;
uint32_t version;
uint32_t len;
char data[MCONSOLE_MAX_DATA];
};
@ -64,24 +64,24 @@ struct mconsole_request {
typedef struct mconsole_reply mconsole_reply;
/** mconsole reply message */
struct mconsole_reply {
u_int32_t err;
u_int32_t more;
u_int32_t len;
uint32_t err;
uint32_t more;
uint32_t len;
char data[MCONSOLE_MAX_DATA];
};
typedef struct mconsole_notify mconsole_notify;
/** mconsole notify message */
struct mconsole_notify {
u_int32_t magic;
u_int32_t version;
uint32_t magic;
uint32_t version;
enum {
MCONSOLE_SOCKET,
MCONSOLE_PANIC,
MCONSOLE_HANG,
MCONSOLE_USER_NOTIFY,
} type;
u_int32_t len;
uint32_t len;
char data[MCONSOLE_MAX_DATA];
};

@ -95,7 +95,7 @@ static void socket_destroy(proxy_socket_t *this)
*/
static u_int socket_hash(host_t *src)
{
u_int16_t port = src->get_port(src);
uint16_t port = src->get_port(src);
return chunk_hash_inc(src->get_address(src),
chunk_hash(chunk_from_thing(port)));
}
@ -222,14 +222,14 @@ CALLBACK(handle_timeout, job_requeue_t,
* DNS header and masks to access flags
*/
typedef struct __attribute__((packed)) {
u_int16_t id;
u_int16_t flags;
uint16_t id;
uint16_t flags;
#define DNS_QR_MASK 0x8000
#define DNS_OPCODE_MASK 0x7800
u_int16_t qdcount;
u_int16_t ancount;
u_int16_t nscount;
u_int16_t arcount;
uint16_t qdcount;
uint16_t ancount;
uint16_t nscount;
uint16_t arcount;
} dns_header_t;
/**
@ -242,7 +242,7 @@ typedef struct __attribute__((packed)) {
static char *extract_hostname(chunk_t data)
{
char *hostname, *pos, *end;
u_int8_t label;
uint8_t label;
if (!data.len || data.len > 255)
{

@ -208,7 +208,7 @@ static job_requeue_t handle_plain(private_android_service_t *this)
* Add a route to the TUN device builder
*/
static bool add_route(vpnservice_builder_t *builder, host_t *net,
u_int8_t prefix)
uint8_t prefix)
{
/* if route is 0.0.0.0/0, split it into two routes 0.0.0.0/1 and
* 128.0.0.0/1 because otherwise it would conflict with the current default
@ -246,7 +246,7 @@ static bool add_routes(vpnservice_builder_t *builder, child_sa_t *child_sa)
while (success && enumerator->enumerate(enumerator, &src_ts, &dst_ts))
{
host_t *net;
u_int8_t prefix;
uint8_t prefix;
dst_ts->to_subnet(dst_ts, &net, &prefix);
success = add_route(builder, net, prefix);
@ -399,7 +399,7 @@ static void close_tun_device(private_android_service_t *this)
* Terminate the IKE_SA with the given unique ID
*/
CALLBACK(terminate, job_requeue_t,
u_int32_t *id)
uint32_t *id)
{
charon->controller->terminate_ike(charon->controller, *id,
controller_cb_empty, NULL, 0);
@ -410,7 +410,7 @@ CALLBACK(terminate, job_requeue_t,
* Reestablish the IKE_SA with the given unique ID
*/
CALLBACK(reestablish, job_requeue_t,
u_int32_t *id)
uint32_t *id)
{
ike_sa_t *ike_sa;
@ -498,7 +498,7 @@ METHOD(listener_t, alert, bool,
break;
case ALERT_KEEP_ON_CHILD_SA_FAILURE:
{
u_int32_t *id = malloc_thing(u_int32_t);
uint32_t *id = malloc_thing(uint32_t);
/* because close_ike_on_child_failure is set this is only
* triggered when CHILD_SA rekeying failed. reestablish it in
@ -514,7 +514,7 @@ METHOD(listener_t, alert, bool,
this->lock->read_lock(this->lock);
if (this->tunfd < 0)
{
u_int32_t *id = malloc_thing(u_int32_t);
uint32_t *id = malloc_thing(uint32_t);
/* always fail if we are not able to initiate the IKE_SA
* initially */
@ -531,14 +531,14 @@ METHOD(listener_t, alert, bool,
else
{
peer_cfg_t *peer_cfg;
u_int32_t tries, try;
uint32_t tries, try;
/* when reestablishing and if keyingtries is not %forever
* the IKE_SA is destroyed after the set number of tries,
* so notify the GUI */
peer_cfg = ike_sa->get_peer_cfg(ike_sa);
tries = peer_cfg->get_keyingtries(peer_cfg);
try = va_arg(args, u_int32_t);
try = va_arg(args, uint32_t);
if (tries != 0 && try == tries-1)
{
charonservice->update_status(charonservice,

@ -404,8 +404,8 @@ static void handle_tcg_attribute(imc_android_state_t *state,
tcg_pts_attr_req_file_meas_t *attr_cast;
pts_file_meas_t *measurements;
pts_error_code_t pts_error;
u_int32_t delim;
u_int16_t req_id;
uint32_t delim;
uint16_t req_id;
bool is_dir;
char *path;

@ -60,7 +60,7 @@ struct private_imc_android_state_t {
/**
* Maximum PA-TNC message size for this TNCCS connection
*/
u_int32_t max_msg_len;
uint32_t max_msg_len;
/**
* PA-TNC attribute segmentation contracts associated with TNCCS connection
@ -99,12 +99,12 @@ METHOD(imc_state_t, set_flags, void,
}
METHOD(imc_state_t, set_max_msg_len, void,
private_imc_android_state_t *this, u_int32_t max_msg_len)
private_imc_android_state_t *this, uint32_t max_msg_len)
{
this->max_msg_len = max_msg_len;
}
METHOD(imc_state_t, get_max_msg_len, u_int32_t,
METHOD(imc_state_t, get_max_msg_len, uint32_t,
private_imc_android_state_t *this)
{
return this->max_msg_len;

@ -40,31 +40,31 @@ struct private_kernel_android_ipsec_t {
/**
* Callback registrered with libipsec.
*/
static void expire(u_int8_t protocol, u_int32_t spi, host_t *dst, bool hard)
static void expire(uint8_t protocol, uint32_t spi, host_t *dst, bool hard)
{
charon->kernel->expire(charon->kernel, protocol, spi, dst, hard);
}
METHOD(kernel_ipsec_t, get_spi, status_t,
private_kernel_android_ipsec_t *this, host_t *src, host_t *dst,
u_int8_t protocol, u_int32_t *spi)
uint8_t protocol, uint32_t *spi)
{
return ipsec->sas->get_spi(ipsec->sas, src, dst, protocol, spi);
}
METHOD(kernel_ipsec_t, get_cpi, status_t,
private_kernel_android_ipsec_t *this, host_t *src, host_t *dst,
u_int16_t *cpi)
uint16_t *cpi)
{
return NOT_SUPPORTED;
}
METHOD(kernel_ipsec_t, add_sa, status_t,
private_kernel_android_ipsec_t *this, host_t *src, host_t *dst,
u_int32_t spi, u_int8_t protocol, u_int32_t reqid, mark_t mark,
u_int32_t tfc, lifetime_cfg_t *lifetime, u_int16_t enc_alg, chunk_t enc_key,
u_int16_t int_alg, chunk_t int_key, ipsec_mode_t mode,
u_int16_t ipcomp, u_int16_t cpi, u_int32_t replay_window,
uint32_t spi, uint8_t protocol, uint32_t reqid, mark_t mark,
uint32_t tfc, lifetime_cfg_t *lifetime, uint16_t enc_alg, chunk_t enc_key,
uint16_t int_alg, chunk_t int_key, ipsec_mode_t mode,
uint16_t ipcomp, uint16_t cpi, uint32_t replay_window,
bool initiator, bool encap, bool esn, bool inbound, bool update,
linked_list_t *src_ts, linked_list_t *dst_ts)
{
@ -75,8 +75,8 @@ METHOD(kernel_ipsec_t, add_sa, status_t,
}
METHOD(kernel_ipsec_t, update_sa, status_t,
private_kernel_android_ipsec_t *this, u_int32_t spi, u_int8_t protocol,
u_int16_t cpi, host_t *src, host_t *dst, host_t *new_src, host_t *new_dst,
private_kernel_android_ipsec_t *this, uint32_t spi, uint8_t protocol,
uint16_t cpi, host_t *src, host_t *dst, host_t *new_src, host_t *new_dst,
bool encap, bool new_encap, mark_t mark)
{
return ipsec->sas->update_sa(ipsec->sas, spi, protocol, cpi, src, dst,
@ -85,8 +85,8 @@ METHOD(kernel_ipsec_t, update_sa, status_t,
METHOD(kernel_ipsec_t, query_sa, status_t,
private_kernel_android_ipsec_t *this, host_t *src, host_t *dst,
u_int32_t spi, u_int8_t protocol, mark_t mark,
u_int64_t *bytes, u_int64_t *packets, time_t *time)
uint32_t spi, uint8_t protocol, mark_t mark,
uint64_t *bytes, uint64_t *packets, time_t *time)
{
return ipsec->sas->query_sa(ipsec->sas, src, dst, spi, protocol, mark,
bytes, packets, time);
@ -94,7 +94,7 @@ METHOD(kernel_ipsec_t, query_sa, status_t,
METHOD(kernel_ipsec_t, del_sa, status_t,
private_kernel_android_ipsec_t *this, host_t *src, host_t *dst,
u_int32_t spi, u_int8_t protocol, u_int16_t cpi, mark_t mark)
uint32_t spi, uint8_t protocol, uint16_t cpi, mark_t mark)
{
return ipsec->sas->del_sa(ipsec->sas, src, dst, spi, protocol, cpi, mark);
}
@ -149,7 +149,7 @@ METHOD(kernel_ipsec_t, bypass_socket, bool,
}
METHOD(kernel_ipsec_t, enable_udp_decap, bool,
private_kernel_android_ipsec_t *this, int fd, int family, u_int16_t port)
private_kernel_android_ipsec_t *this, int fd, int family, uint16_t port)
{
return NOT_SUPPORTED;
}

@ -246,14 +246,14 @@ METHOD(kernel_net_t, del_ip, status_t,
}
METHOD(kernel_net_t, add_route, status_t,
private_android_net_t *this, chunk_t dst_net, u_int8_t prefixlen,
private_android_net_t *this, chunk_t dst_net, uint8_t prefixlen,
host_t *gateway, host_t *src_ip, char *if_name)
{
return NOT_SUPPORTED;
}
METHOD(kernel_net_t, del_route, status_t,
private_android_net_t *this, chunk_t dst_net, u_int8_t prefixlen,
private_android_net_t *this, chunk_t dst_net, uint8_t prefixlen,
host_t *gateway, host_t *src_ip, char *if_name)
{
return NOT_SUPPORTED;

@ -78,12 +78,12 @@ static void destroy_entry(entry_t *entry)
/**
* Find an IKE_SA unique identifier by a given XPC channel
*/
static u_int32_t find_ike_sa_by_conn(private_xpc_channels_t *this,
static uint32_t find_ike_sa_by_conn(private_xpc_channels_t *this,
xpc_connection_t conn)
{
enumerator_t *enumerator;
entry_t *entry;
u_int32_t ike_sa = 0;
uint32_t ike_sa = 0;
this->lock->read_lock(this->lock);
enumerator = this->channels->create_enumerator(this->channels);
@ -126,7 +126,7 @@ static void remove_conn(private_xpc_channels_t *this, xpc_connection_t conn)
/**
* Trigger termination of a connection
*/
static void stop_connection(private_xpc_channels_t *this, u_int32_t ike_sa,
static void stop_connection(private_xpc_channels_t *this, uint32_t ike_sa,
xpc_object_t request, xpc_object_t reply)
{
status_t status;
@ -141,7 +141,7 @@ static void stop_connection(private_xpc_channels_t *this, u_int32_t ike_sa,
*/
static struct {
char *name;
void (*handler)(private_xpc_channels_t *this, u_int32_t ike_sa,
void (*handler)(private_xpc_channels_t *this, uint32_t ike_sa,
xpc_object_t request, xpc_object_t reply);
} commands[] = {
{ "stop_connection", stop_connection },
@ -156,7 +156,7 @@ static void handle(private_xpc_channels_t *this, xpc_connection_t conn,
xpc_object_t reply;
const char *type, *rpc;
bool found = FALSE;
u_int32_t ike_sa;
uint32_t ike_sa;
int i;
type = xpc_dictionary_get_string(request, "type");
@ -201,7 +201,7 @@ static void handle(private_xpc_channels_t *this, xpc_connection_t conn,
}
METHOD(xpc_channels_t, add, void,
private_xpc_channels_t *this, xpc_connection_t conn, u_int32_t ike_sa)
private_xpc_channels_t *this, xpc_connection_t conn, uint32_t ike_sa)
{
entry_t *entry;
@ -466,7 +466,7 @@ static shared_key_t* password_cb(private_xpc_channels_t *this,
shared_key_t *shared = NULL;
ike_sa_t *ike_sa;
entry_t *entry;
u_int32_t sa;
uint32_t sa;
switch (type)
{

@ -45,7 +45,7 @@ struct xpc_channels_t {
* @param conn XPC connection to channel
* @param ike_sa IKE_SA unique identifier to associate to connection
*/
void (*add)(xpc_channels_t *this, xpc_connection_t conn, u_int32_t ike_sa);
void (*add)(xpc_channels_t *this, xpc_connection_t conn, uint32_t ike_sa);
/**
* Destroy a xpc_channels_t.

@ -77,7 +77,7 @@ static peer_cfg_t* create_peer_cfg(char *name, char *host)
{
ike_cfg_t *ike_cfg;
peer_cfg_t *peer_cfg;
u_int16_t local_port, remote_port = IKEV2_UDP_PORT;
uint16_t local_port, remote_port = IKEV2_UDP_PORT;
local_port = charon->socket->get_port(charon->socket, FALSE);
if (local_port != IKEV2_UDP_PORT)
@ -154,7 +154,7 @@ static child_cfg_t* create_child_cfg(char *name)
/**
* Controller initiate callback
*/
static bool initiate_cb(u_int32_t *sa, debug_t group, level_t level,
static bool initiate_cb(uint32_t *sa, debug_t group, level_t level,
ike_sa_t *ike_sa, const char *message)
{
if (ike_sa)
@ -177,7 +177,7 @@ void start_connection(private_xpc_dispatch_t *this,
bool success = FALSE;
xpc_endpoint_t endpoint;
xpc_connection_t channel;
u_int32_t ike_sa;
uint32_t ike_sa;
name = (char*)xpc_dictionary_get_string(request, "name");
host = (char*)xpc_dictionary_get_string(request, "host");

@ -35,7 +35,7 @@ struct private_xpc_logger_t {
/**
* IKE_SA we log for
*/
u_int32_t ike_sa;
uint32_t ike_sa;
};
METHOD(logger_t, log_, void,
@ -62,7 +62,7 @@ METHOD(logger_t, get_level, level_t,
}
METHOD(xpc_logger_t, set_ike_sa, void,
private_xpc_logger_t *this, u_int32_t ike_sa)
private_xpc_logger_t *this, uint32_t ike_sa)
{
this->ike_sa = ike_sa;
}

@ -42,7 +42,7 @@ struct xpc_logger_t {
*
* @param ike_sa IKE_SA unique identifier
*/
void (*set_ike_sa)(xpc_logger_t *this, u_int32_t ike_sa);
void (*set_ike_sa)(xpc_logger_t *this, uint32_t ike_sa);
/**
* Destroy a xpc_logger_t.

@ -159,7 +159,7 @@ struct sadb_spirange {
struct sadb_x_kmprivate {
uint16_t sadb_x_kmprivate_len;
uint16_t sadb_x_kmprivate_exttype;
u_int32_t sadb_x_kmprivate_reserved;
uint32_t sadb_x_kmprivate_reserved;
} __attribute__((packed));
/* sizeof(struct sadb_x_kmprivate) == 8 */

@ -142,7 +142,7 @@ static host_t* offset2host(private_mem_pool_t *pool, int offset)
{
chunk_t addr;
host_t *host;
u_int32_t *pos;
uint32_t *pos;
offset--;
if (offset > pool->size)
@ -153,11 +153,11 @@ static host_t* offset2host(private_mem_pool_t *pool, int offset)
addr = chunk_clone(pool->base->get_address(pool->base));
if (pool->base->get_family(pool->base) == AF_INET6)
{
pos = (u_int32_t*)(addr.ptr + 12);
pos = (uint32_t*)(addr.ptr + 12);
}
else
{
pos = (u_int32_t*)addr.ptr;
pos = (uint32_t*)addr.ptr;
}
*pos = htonl(offset + ntohl(*pos));
host = host_create_from_chunk(pool->base->get_family(pool->base), addr, 0);
@ -171,7 +171,7 @@ static host_t* offset2host(private_mem_pool_t *pool, int offset)
static int host2offset(private_mem_pool_t *pool, host_t *addr)
{
chunk_t host, base;
u_int32_t hosti, basei;
uint32_t hosti, basei;
if (addr->get_family(addr) != pool->base->get_family(pool->base))
{
@ -189,8 +189,8 @@ static int host2offset(private_mem_pool_t *pool, host_t *addr)
host = chunk_skip(host, 12);
base = chunk_skip(base, 12);
}
hosti = ntohl(*(u_int32_t*)(host.ptr));
basei = ntohl(*(u_int32_t*)(base.ptr));
hosti = ntohl(*(uint32_t*)(host.ptr));
basei = ntohl(*(uint32_t*)(base.ptr));
if (hosti > basei + pool->size)
{
return -1;
@ -634,7 +634,7 @@ static private_mem_pool_t *create_generic(char *name)