From 229c27f06a3158f4068d40d3ffe2913457a23af9 Mon Sep 17 00:00:00 2001 From: tobhe Date: Sat, 3 Dec 2022 22:34:35 +0000 Subject: [PATCH] Consistently use uintXX_t from instead of u_intXX_t. --- regress/sbin/iked/parser/common.c | 24 +++---- regress/sbin/iked/parser/test_parser_fuzz.c | 72 ++++++++++----------- regress/sbin/iked/test_helper/test_helper.c | 12 ++-- regress/sbin/iked/test_helper/test_helper.h | 8 +-- sbin/iked/config.c | 8 +-- sbin/iked/dh.c | 6 +- sbin/iked/iked.h | 6 +- sbin/iked/ocsp.c | 4 +- usr.sbin/ikectl/ikectl.c | 4 +- 9 files changed, 72 insertions(+), 72 deletions(-) diff --git a/regress/sbin/iked/parser/common.c b/regress/sbin/iked/parser/common.c index 79f9478bebd..84bc3ce136d 100644 --- a/regress/sbin/iked/parser/common.c +++ b/regress/sbin/iked/parser/common.c @@ -1,4 +1,4 @@ -/* $OpenBSD: common.c,v 1.12 2022/03/15 13:07:33 tobhe Exp $ */ +/* $OpenBSD: common.c,v 1.13 2022/12/03 22:34:35 tobhe Exp $ */ /* * A bunch of stub functions so we can compile and link ikev2_pld.c * in a standalone program for testing purposes. @@ -21,18 +21,18 @@ int eap_parse(struct iked *, const struct iked_sa *, struct iked_message *, void *, int); int ikev2_msg_frompeer(struct iked_message *); int ikev2_send_ike_e(struct iked *, struct iked_sa *, struct ibuf *, - u_int8_t, u_int8_t, int); + uint8_t, uint8_t, int); void ikev2_ikesa_recv_delete(struct iked *, struct iked_sa *); struct iked_childsa * - childsa_lookup(struct iked_sa *, u_int64_t, u_int8_t); + childsa_lookup(struct iked_sa *, uint64_t, uint8_t); int ikev2_childsa_delete(struct iked *, struct iked_sa *, - u_int8_t, u_int64_t, u_int64_t *, int); + uint8_t, uint64_t, uint64_t *, int); int sa_stateok(const struct iked_sa *, int); void sa_state(struct iked *, struct iked_sa *, int); void ikev2_disable_rekeying(struct iked *, struct iked_sa *); void ikev2_init_ike_sa(struct iked *, void *); struct dh_group * - group_get(u_int32_t); + group_get(uint32_t); void timer_set(struct iked *, struct iked_timer *, void (*)(struct iked *, void *), void *); void timer_add(struct iked *, struct iked_timer *, int); @@ -40,7 +40,7 @@ void timer_del(struct iked *, struct iked_timer *); ssize_t ikev2_nat_detection(struct iked *, struct iked_message *, void *, size_t, u_int, int); int ca_setreq(struct iked *, struct iked_sa *, struct iked_static_id *, - u_int8_t, u_int8_t, u_int8_t *, size_t, enum privsep_procid); + uint8_t, uint8_t, uint8_t *, size_t, enum privsep_procid); int ikev2_print_id(struct iked_id *, char *, size_t); int config_add_transform(struct iked_proposal *, u_int, u_int, u_int, u_int); @@ -67,7 +67,7 @@ ikev2_msg_frompeer(struct iked_message *msg) int ikev2_send_ike_e(struct iked *env, struct iked_sa *sa, struct ibuf *buf, - u_int8_t firstpayload, u_int8_t exchange, int response) + uint8_t firstpayload, uint8_t exchange, int response) { return (0); } @@ -84,14 +84,14 @@ ikev2_ikesa_info(uint64_t spi, const char *msg) } struct iked_childsa * -childsa_lookup(struct iked_sa *a, u_int64_t b, u_int8_t c) +childsa_lookup(struct iked_sa *a, uint64_t b, uint8_t c) { return (NULL); } int -ikev2_childsa_delete(struct iked *a, struct iked_sa *b, u_int8_t c, - u_int64_t d, u_int64_t *e , int f) +ikev2_childsa_delete(struct iked *a, struct iked_sa *b, uint8_t c, + uint64_t d, uint64_t *e , int f) { return (0); } @@ -118,7 +118,7 @@ ikev2_init_ike_sa(struct iked *a, void *b) } const struct group_id * -group_getid(u_int32_t id) +group_getid(uint32_t id) { return (NULL); } @@ -148,7 +148,7 @@ ikev2_nat_detection(struct iked *env, struct iked_message *msg, int ca_setreq(struct iked *env, struct iked_sa *sh, struct iked_static_id *localid, - u_int8_t type, u_int8_t more, u_int8_t *data, size_t len, + uint8_t type, uint8_t more, uint8_t *data, size_t len, enum privsep_procid procid) { return (0); diff --git a/regress/sbin/iked/parser/test_parser_fuzz.c b/regress/sbin/iked/parser/test_parser_fuzz.c index edd602e25c7..00b7a6c36a9 100644 --- a/regress/sbin/iked/parser/test_parser_fuzz.c +++ b/regress/sbin/iked/parser/test_parser_fuzz.c @@ -1,4 +1,4 @@ -/* $OpenBSD: test_parser_fuzz.c,v 1.6 2022/02/22 13:47:21 claudio Exp $ */ +/* $OpenBSD: test_parser_fuzz.c,v 1.7 2022/12/03 22:34:35 tobhe Exp $ */ /* * Fuzz tests for payload parsing * @@ -23,22 +23,22 @@ extern int ikev2_pld_payloads(struct iked *, struct iked_message *, void parser_fuzz_tests(void); -u_int8_t cookies[] = { +uint8_t cookies[] = { 0xde, 0xad, 0xbe, 0xef, 0xca, 0xfe, 0x00, 0x01, /* initator cookie */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 /* responder cookie */ }; -u_int8_t genhdr[] = { +uint8_t genhdr[] = { 0x00, 0x20, 0x22, 0x08, /* next, major/minor, exchange type, flags */ 0x00, 0x00, 0x00, 0x00, /* message ID */ 0x00, 0x00, 0x00, 0x00 /* total length */ }; -u_int8_t sa_pld[] = { +uint8_t sa_pld[] = { 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x08, 0x01, 0x01, 0x00, 0x00 }; -u_int8_t saxform_pld[] = { +uint8_t saxform_pld[] = { 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x3c, 0x01, 0x01, 0x00, 0x06, 0x03, 0x00, 0x00, 0x08, 0x03, 0x00, 0x00, 0x0c, 0x03, 0x00, 0x00, 0x0c, @@ -49,7 +49,7 @@ u_int8_t saxform_pld[] = { 0x00, 0x00, 0x00, 0x08, 0x02, 0x00, 0x00, 0x01 }; -u_int8_t ke_pld[] = { +uint8_t ke_pld[] = { 0x00, 0x00, 0x01, 0x08, 0x00, 0x0e, 0x00, 0x00, 0x16, 0xcb, 0x68, 0xaf, 0x63, 0xfe, 0xb0, 0x58, 0x49, 0x0e, 0x7f, 0x85, 0x60, 0x53, 0x80, 0xae, 0x3f, 0x82, 0xf3, 0x35, 0x21, 0xd5, @@ -79,14 +79,14 @@ u_int8_t ke_pld[] = { 0x8e, 0x1f, 0xd8, 0x60 }; -u_int8_t nonce_pld[] = { +uint8_t nonce_pld[] = { 0x00, 0x00, 0x00, 0x24, 0x5f, 0x61, 0x42, 0x72, 0x7d, 0xb2, 0xa8, 0xc1, 0xfe, 0xb1, 0x38, 0x2e, 0xb8, 0x75, 0xa7, 0xc1, 0x1d, 0x8a, 0xa7, 0xb7, 0x9b, 0x92, 0xe2, 0x0e, 0x3a, 0x18, 0x20, 0xb6, 0x16, 0xf3, 0x35, 0x67, }; -u_int8_t notify_pld[] = { +uint8_t notify_pld[] = { 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x40, 0x04, 0xc7, 0xa0, 0x68, 0x68, 0x09, 0x0a, 0x7f, 0x12, 0x0b, 0x13, 0xd3, 0x2f, 0xde, 0x64, 0x8b, 0xf1, 0xc3, 0x3c, 0x79, 0x8f, 0x00, 0x00, @@ -95,12 +95,12 @@ u_int8_t notify_pld[] = { 0xa8, 0xf9, 0xeb, 0xdf, 0x9f, 0x2c }; -u_int8_t id_pld[] = { +uint8_t id_pld[] = { 0x00, 0x00, 0x00, 0x0c, 0x01, 0x00, 0x00, 0x00, 0xac, 0x12, 0x7d, 0x01 }; -u_int8_t cert_pld[] = { +uint8_t cert_pld[] = { 0x00, 0x00, 0x01, 0x10, 0x0b, 0x00, 0x00, 0x00, 0x30, 0x82, 0x01, 0x0c, 0x02, 0x82, 0x01, 0x01, 0x00, 0x8a, 0x26, 0xf8, 0x9e, 0xe8, 0x09, 0x11, 0x6b, 0x3d, 0x00, 0xd3, @@ -132,11 +132,11 @@ u_int8_t cert_pld[] = { 0x8e, 0xcf }; -u_int8_t certreq_pld[] = { +uint8_t certreq_pld[] = { 0x00, 0x00, 0x00, 0x05, 0x0b }; -u_int8_t auth_pld[] = { +uint8_t auth_pld[] = { 0x00, 0x00, 0x01, 0x08, 0x01, 0x00, 0x00, 0x00, 0x2a, 0x34, 0x80, 0x52, 0x3c, 0x86, 0x1c, 0xfa, 0x9a, 0x2b, 0x8b, 0xff, 0xbb, 0xb5, 0x0d, 0x6b, 0xa1, 0x62, 0x58, 0xd8, @@ -166,18 +166,18 @@ u_int8_t auth_pld[] = { 0xba, 0x71, 0x77, 0xfe, 0x2c, 0x6d }; -u_int8_t delete_pld[] = { +uint8_t delete_pld[] = { 0x2a, 0x00, 0x00, 0x10, 0x01, 0x08, 0x00, 0x01, /* IKE SA */ 0xde, 0xad, 0xbe, 0xef, 0xca, 0xfe, 0xaf, 0xfe, 0x00, 0x00, 0x00, 0x10, 0x03, 0x04, 0x00, 0x02, /* ESP SA */ 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff, 0x00, 0x11 }; -u_int8_t vendor_pld[] = { +uint8_t vendor_pld[] = { 0x00, 0x00, 0x00, 0x08, 0x11, 0x22, 0x33, 0x44 }; -u_int8_t ts_pld[] = { +uint8_t ts_pld[] = { 0x00, 0x00, 0x00, 0x18, 0x01, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x10, 0x00, 0x00, 0xff, 0xff, 0xac, 0x28, 0x7d, 0x00, 0xac, 0x28, 0x7d, 0xff @@ -227,7 +227,7 @@ uint8_t skf_1of1_pld[] = { 0x75, 0xd9, 0xc4, 0xd0, 0x3d, 0xa1, 0xa5, 0x8f }; -u_int8_t sk_pld[] = { +uint8_t sk_pld[] = { 0x21, 0x00, 0x01, 0x94, 0x14, 0x77, 0x25, 0x7b, 0x82, 0xc0, 0xdb, 0x0b, 0x24, 0x36, 0x36, 0x13, 0x36, 0xe4, 0x99, 0xad, 0xf5, 0xaf, 0x26, 0x6f, 0x47, 0xd2, 0x0d, 0x65, 0xe1, 0xa8, @@ -271,7 +271,7 @@ u_int8_t sk_pld[] = { 0x3d, 0xa1, 0xa5, 0x8f }; -u_int8_t cp_pld[] = { +uint8_t cp_pld[] = { 0x2f, 0x00, 0x00, 0x0c, 0x01, 0x00, 0x00, 0x00, /* REQUEST */ 0x00, 0x01, 0x00, 0x00, /* INTERNAL_IP4_ADDRESS */ @@ -294,7 +294,7 @@ u_int8_t cp_pld[] = { 0x04, 0x00, 0x00, 0x00, /* ACK (empty) */ }; -u_int8_t eap_pld[] = { +uint8_t eap_pld[] = { 0x30, 0x00, 0x00, 0x09, 0x01, 0x00, 0x00, 0x05, 0x01, 0x30, 0x00, 0x00, 0x0c, @@ -306,7 +306,7 @@ u_int8_t eap_pld[] = { }; /* Valid initator packet */ -u_int8_t valid_packet[] = { +uint8_t valid_packet[] = { 0xde, 0xad, 0xbe, 0xef, 0xca, 0xfe, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0x20, 0x22, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xc0, 0x22, 0x00, @@ -361,53 +361,53 @@ u_int8_t valid_packet[] = { #define OFFSET_EXCHANGE (2 + sizeof(cookies)) #define OFFSET_LENGTH (8 + sizeof(cookies)) -static u_int8_t * -get_icookie(u_int8_t *data) +static uint8_t * +get_icookie(uint8_t *data) { return &data[OFFSET_ICOOKIE]; } -static u_int8_t * -get_rcookie(u_int8_t *data) +static uint8_t * +get_rcookie(uint8_t *data) { return &data[OFFSET_RCOOKIE]; } -static u_int8_t -get_nextpayload(u_int8_t *data) +static uint8_t +get_nextpayload(uint8_t *data) { return data[OFFSET_NEXTPAYLOAD]; } -static u_int8_t -get_version(u_int8_t *data) +static uint8_t +get_version(uint8_t *data) { return data[OFFSET_VERSION]; } -static u_int8_t -get_exchange(u_int8_t *data) +static uint8_t +get_exchange(uint8_t *data) { return data[OFFSET_EXCHANGE]; } -static u_int32_t -get_length(u_int8_t *data) +static uint32_t +get_length(uint8_t *data) { - return *(u_int32_t *)&data[OFFSET_LENGTH]; + return *(uint32_t *)&data[OFFSET_LENGTH]; } static void -set_length(u_int8_t *data, u_int32_t length) +set_length(uint8_t *data, uint32_t length) { - u_int32_t *p; + uint32_t *p; - p = (u_int32_t *)&data[OFFSET_LENGTH]; + p = (uint32_t *)&data[OFFSET_LENGTH]; *p = htobe32(length); } static void -set_nextpayload(u_int8_t *data, u_int8_t next) +set_nextpayload(uint8_t *data, uint8_t next) { data[OFFSET_NEXTPAYLOAD] = next; } diff --git a/regress/sbin/iked/test_helper/test_helper.c b/regress/sbin/iked/test_helper/test_helper.c index 26ff4a629c9..f3a05fbea87 100644 --- a/regress/sbin/iked/test_helper/test_helper.c +++ b/regress/sbin/iked/test_helper/test_helper.c @@ -247,7 +247,7 @@ assert_string(const char *file, int line, const char *a1, const char *a2, static char * tohex(const void *_s, size_t l) { - u_int8_t *s = (u_int8_t *)_s; + uint8_t *s = (uint8_t *)_s; size_t i, j; const char *hex = "0123456789abcdef"; char *r = malloc((l * 2) + 1); @@ -277,7 +277,7 @@ assert_mem(const char *file, int line, const char *a1, const char *a2, } static int -memvalcmp(const u_int8_t *s, u_char v, size_t l, size_t *where) +memvalcmp(const uint8_t *s, u_char v, size_t l, size_t *where) { size_t i; @@ -371,7 +371,7 @@ assert_char(const char *file, int line, const char *a1, const char *a2, void assert_u8(const char *file, int line, const char *a1, const char *a2, - u_int8_t aa1, u_int8_t aa2, enum test_predicate pred) + uint8_t aa1, uint8_t aa2, enum test_predicate pred) { TEST_CHECK(aa1, aa2, pred); test_header(file, line, a1, a2, "U8", pred); @@ -382,7 +382,7 @@ assert_u8(const char *file, int line, const char *a1, const char *a2, void assert_u16(const char *file, int line, const char *a1, const char *a2, - u_int16_t aa1, u_int16_t aa2, enum test_predicate pred) + uint16_t aa1, uint16_t aa2, enum test_predicate pred) { TEST_CHECK(aa1, aa2, pred); test_header(file, line, a1, a2, "U16", pred); @@ -393,7 +393,7 @@ assert_u16(const char *file, int line, const char *a1, const char *a2, void assert_u32(const char *file, int line, const char *a1, const char *a2, - u_int32_t aa1, u_int32_t aa2, enum test_predicate pred) + uint32_t aa1, uint32_t aa2, enum test_predicate pred) { TEST_CHECK(aa1, aa2, pred); test_header(file, line, a1, a2, "U32", pred); @@ -404,7 +404,7 @@ assert_u32(const char *file, int line, const char *a1, const char *a2, void assert_u64(const char *file, int line, const char *a1, const char *a2, - u_int64_t aa1, u_int64_t aa2, enum test_predicate pred) + uint64_t aa1, uint64_t aa2, enum test_predicate pred) { TEST_CHECK(aa1, aa2, pred); test_header(file, line, a1, a2, "U64", pred); diff --git a/regress/sbin/iked/test_helper/test_helper.h b/regress/sbin/iked/test_helper/test_helper.h index 6e81aa0ea06..ef43766bbe1 100644 --- a/regress/sbin/iked/test_helper/test_helper.h +++ b/regress/sbin/iked/test_helper/test_helper.h @@ -69,16 +69,16 @@ void assert_ptr(const char *file, int line, const void *aa1, const void *aa2, enum test_predicate pred); void assert_u8(const char *file, int line, const char *a1, const char *a2, - u_int8_t aa1, u_int8_t aa2, enum test_predicate pred); + uint8_t aa1, uint8_t aa2, enum test_predicate pred); void assert_u16(const char *file, int line, const char *a1, const char *a2, - u_int16_t aa1, u_int16_t aa2, enum test_predicate pred); + uint16_t aa1, uint16_t aa2, enum test_predicate pred); void assert_u32(const char *file, int line, const char *a1, const char *a2, - u_int32_t aa1, u_int32_t aa2, enum test_predicate pred); + uint32_t aa1, uint32_t aa2, enum test_predicate pred); void assert_u64(const char *file, int line, const char *a1, const char *a2, - u_int64_t aa1, u_int64_t aa2, enum test_predicate pred); + uint64_t aa1, uint64_t aa2, enum test_predicate pred); #define TEST_START(n) test_start(n) #define TEST_DONE() test_done() diff --git a/sbin/iked/config.c b/sbin/iked/config.c index 23ae676842c..711c29cb17d 100644 --- a/sbin/iked/config.c +++ b/sbin/iked/config.c @@ -1,4 +1,4 @@ -/* $OpenBSD: config.c,v 1.90 2022/11/18 18:56:39 mbuhl Exp $ */ +/* $OpenBSD: config.c,v 1.91 2022/12/03 22:34:35 tobhe Exp $ */ /* * Copyright (c) 2019 Tobias Heider @@ -950,11 +950,11 @@ config_setocsp(struct iked *env) int config_getocsp(struct iked *env, struct imsg *imsg) { - size_t have, need; - u_int8_t *ptr; + size_t have, need; + uint8_t *ptr; free(env->sc_ocsp_url); - ptr = (u_int8_t *)imsg->data; + ptr = (uint8_t *)imsg->data; have = IMSG_DATA_SIZE(imsg); /* get tolerate */ diff --git a/sbin/iked/dh.c b/sbin/iked/dh.c index 8c46e1b60e3..efe0bf2838d 100644 --- a/sbin/iked/dh.c +++ b/sbin/iked/dh.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dh.c,v 1.31 2021/12/13 18:06:56 tb Exp $ */ +/* $OpenBSD: dh.c,v 1.32 2022/12/03 22:34:35 tobhe Exp $ */ /* * Copyright (c) 2010-2014 Reyk Floeter @@ -838,8 +838,8 @@ kemsx_create_shared2(struct dh_group *group, struct ibuf **sharedp, struct kemsx_key *kemsx = group->kemsx; struct ibuf *buf = NULL; EVP_MD_CTX *ctx = NULL; - u_int8_t *cp; - u_int8_t shared[CURVE25519_SIZE]; + uint8_t *cp; + uint8_t shared[CURVE25519_SIZE]; size_t have, need; u_int len; diff --git a/sbin/iked/iked.h b/sbin/iked/iked.h index e6805b86c91..01ea6a496b4 100644 --- a/sbin/iked/iked.h +++ b/sbin/iked/iked.h @@ -1,4 +1,4 @@ -/* $OpenBSD: iked.h,v 1.207 2022/09/19 20:54:02 tobhe Exp $ */ +/* $OpenBSD: iked.h,v 1.208 2022/12/03 22:34:35 tobhe Exp $ */ /* * Copyright (c) 2019 Tobias Heider @@ -1195,11 +1195,11 @@ int imsg_compose_event(struct imsgev *, uint16_t, uint32_t, int imsg_composev_event(struct imsgev *, uint16_t, uint32_t, pid_t, int, const struct iovec *, int); int proc_compose_imsg(struct privsep *, enum privsep_procid, int, - u_int16_t, u_int32_t, int, void *, u_int16_t); + uint16_t, uint32_t, int, void *, uint16_t); int proc_compose(struct privsep *, enum privsep_procid, uint16_t, void *, uint16_t); int proc_composev_imsg(struct privsep *, enum privsep_procid, int, - u_int16_t, u_int32_t, int, const struct iovec *, int); + uint16_t, uint32_t, int, const struct iovec *, int); int proc_composev(struct privsep *, enum privsep_procid, uint16_t, const struct iovec *, int); int proc_forward_imsg(struct privsep *, struct imsg *, diff --git a/sbin/iked/ocsp.c b/sbin/iked/ocsp.c index 0b05a620ffa..b6f41d3055c 100644 --- a/sbin/iked/ocsp.c +++ b/sbin/iked/ocsp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ocsp.c,v 1.23 2021/12/13 17:35:34 tobhe Exp $ */ +/* $OpenBSD: ocsp.c,v 1.24 2022/12/03 22:34:35 tobhe Exp $ */ /* * Copyright (c) 2014 Markus Friedl @@ -263,7 +263,7 @@ ocsp_connect_finish(struct iked *env, int fd, struct ocsp_connect *oc) /* validate the certifcate stored in 'data' by querying the ocsp-responder */ int ocsp_validate_cert(struct iked *env, void *data, size_t len, - struct iked_sahdr sh, u_int8_t type, X509 *issuer) + struct iked_sahdr sh, uint8_t type, X509 *issuer) { struct iovec iov[2]; STACK_OF(OPENSSL_STRING) *aia; /* Authority Information Access */ diff --git a/usr.sbin/ikectl/ikectl.c b/usr.sbin/ikectl/ikectl.c index cc10c628b50..4eb3d8ee517 100644 --- a/usr.sbin/ikectl/ikectl.c +++ b/usr.sbin/ikectl/ikectl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ikectl.c,v 1.28 2022/09/19 20:54:02 tobhe Exp $ */ +/* $OpenBSD: ikectl.c,v 1.29 2022/12/03 22:34:35 tobhe Exp $ */ /* * Copyright (c) 2007-2013 Reyk Floeter @@ -431,7 +431,7 @@ show_string(struct imsg *imsg) } static char * -plural(u_int64_t n) +plural(uint64_t n) { return (n != 1 ? "s" : ""); } -- 2.20.1